from polyglot.transliteration import Transliterator

"""
Explanation: Transliteration
Transliteration is the conversion of a text from one script to another.
For instance, a Latin transliteration of the Greek phrase "Ελληνική Δημοκρατία", usually translated as 'Hellenic Republic', is "Ellēnikḗ Dēmokratía".
End of explanation
"""


from polyglot.downloader import downloader
print(downloader.supported_languages_table("transliteration2"))

"""
Explanation: Languages Coverage
End of explanation
"""


%%bash
polyglot download embeddings2.en pos2.en

"""
Explanation: Downloading Necessary Models
End of explanation
"""


from polyglot.text import Text

blob = """We will meet at eight o'clock on Thursday morning."""
text = Text(blob)

"""
Explanation: Example
We tag each word in the text with one part of speech.
End of explanation
"""


for x in text.transliterate("ar"):
  print(x)

"""
Explanation: We can query all the tagged words
End of explanation
"""


!polyglot --lang en tokenize --input testdata/cricket.txt |  polyglot --lang en transliteration --target ar | tail -n 30

"""
Explanation: Command Line Interface
End of explanation
"""


