Skip to content

Convert Greek text to Greeklish conforming to ISO 843 (ELOT 743)

License

Notifications You must be signed in to change notification settings

agorf/greeklish_iso843

Repository files navigation

greeklish_iso843 Gem RuboCop Tests

A Ruby library that converts Greek text to Greeklish, conforming to the ISO 843 standard (based on the Greek standard ELOT 743 or ΕΛΟΤ 743) used by the Greek state.

Demo

An online service that uses this Gem is available at https://greeklish.xyz

Installation

As a Gem:

gem install greeklish_iso843

Use

Require the library in your code:

require 'greeklish_iso843'

Then you can use it to convert text:

GreeklishIso843::GreekText.to_greeklish("Μπάμπης") # => "Bampis"
GreeklishIso843::GreekText.to_greeklish("Άγγελος") # => "Angelos"
GreeklishIso843::GreekText.to_greeklish("Ευάγγελος") # => "Evangelos"
GreeklishIso843::GreekText.to_greeklish("ξεσκεπάζω την ψυχοφθόρα σας βδελυγμία") # => "xeskepazo tin psychofthora sas vdelygmia"

Alternatively, you can require the String core extension for more convenience:

require 'greeklish_iso843/core_ext/string'

Then you can use it to convert text:

"Μπάμπης".to_greeklish # => "Bampis"

There's also a command line utility that accepts Greek text from the standard input and prints the corresponding Greeklish text to the standard output:

$ greeklish_iso843
Μπάμπης
^D
Bampis
$

Note: ^D represents the EOF (End Of File) character, emitted with Ctrl-D.

Tests

You can run the tests with rake test or rake test TESTOPTS='-v' for a more verbose output.

Acknowledgements

This library was initially based on an official, buggy implementation in JavaScript by the Hellenic Police.

License

MIT

Author

Angelos Orfanakos

About

Convert Greek text to Greeklish conforming to ISO 843 (ELOT 743)

Resources

License

Stars

Watchers

Forks

Languages