Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, ligatures=False, cedict_file=None, rules_file='pinyin-to-ipa.txt'):
"""Construct epitran object for Traditional Chinese
Args:
ligatures (bool): if True, use ligatures instead of standard IPA
cedict_file (str): path to CC-CEDict dictionary file
rules_file (str): name of file with rules for converting pinyin to
IPA
"""
if not cedict_file:
raise MissingData('Please specify a location for the CC-CEDict file.')
rules_file = os.path.join('data', 'rules', rules_file)
rules_file = pkg_resources.resource_filename(__name__, rules_file)
self.cedict = cedict.CEDictTrie(cedict_file, traditional=True)
self.rules = rules.Rules([rules_file])
self.regexp = re.compile(r'\p{Han}')