transNatiaonal characters transcription module | |
Download |
trans Ranking & Summary
Advertisement
- License:
- GPL
- Price:
- FREE
- Publisher Name:
- Zelenyak Aleksandr
- Publisher web site:
- http://www.python.org/pypi/trans/
trans Tags
trans Description
Natiaonal characters transcription module trans is a Python module that translates national characters into similar sounding latin characters (transliteration). At the moment, Greek, Turkish, Russian, Ukrainian, Czech, Polish, Latvian alphabets are supported(it covers 99% of needs).>>> import trans>>> u'qwerty'.encode('trans')'qwerty'>>> u'йцукен'.encode('trans')'jcuken'>>> 'qwerty'.encode('trans')TypeError: trans codec support only unicode string, str given.>>> print u'1 2 3 4 56 7 8 9 0'.encode('trans')1 2 3 4 56 7 8 9 0>>> print u'1 2 3 4 56 7 8 9 0'.encode('trans/id')1_2_3_4_5__6_7_8_9_0>>> s = u'''... -- Раскудрить твою чере· коромысло в бога душу мать... триста тысяч ра· едрену вошь тебе в крыло... и кактус в глотку! -- в·ревел ра·ъяренный Никодим.... -- Аминь, -- робко добавил и· склепа папа Пий.... (c) Г. Л. Олди, "Ска·ки дедушки вампира".'''>>> print s.encode('trans') -- Raskudrit tvoyu cherez koromyslo v boga dushu mat trista tysyach raz edrenu vosh tebe v krylo i kaktus v glotku! -- vzrevel razyarennyj Nikodim. -- Amin, -- robko dobavil iz sklepa papa Pij. (c) G. L. Oldi, "Skazki dedushki vampira".>>> print s.encode('trans/id')__________________c__G__L__Oldi___Skazki_dedushki_vampira___>>>>>> u'1 2 3 4 5 6 7 8 9 0'.encode('trans/my')ValueError: Table "my" not found in tables!>>> trans.tables = {u'1': '11', u'2': '22'}>>> u'1 2 3 4 5 6 7 8 9 0'.encode('trans/my')'11_22________________'>>> Requirements: · Python
trans Related Software