dmort27 / epitran

A tool for transcribing orthographic text as IPA (International Phonetic Alphabet)
MIT License
630 stars 121 forks source link

Chinese traditional doesn't seem to work #71

Closed ftyers closed 3 years ago

ftyers commented 3 years ago
>>> import epitran
>>> epi = epitran.Epitran('cmn-Hans', cedict_file='zh')
>>> epi.transliterate('为什么')
'weiʂenme'
>>> epi = epitran.Epitran('cmn-Hant', cedict_file='zh')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/fran/.local/lib/python3.8/site-packages/epitran/_epitran.py", line 44, in __init__
    self.epi = self.special[code](ligatures=ligatures, cedict_file=cedict_file, tones=tones)
TypeError: __init__() got an unexpected keyword argument 'tones'
ftyers commented 3 years ago

Probably the constructor should allow the tones argument:

class EpihanTraditional(Epihan):
    def __init__(self, ligatures=False, cedict_file=None, rules_file='pinyin-to-ipa.txt'):
ftyers commented 3 years ago

This is a duplicate of #68.