def translit_pl(text, lang): assert lang in ('pl', 'cu', 'el') if lang == 'pl': return text elif lang == 'cu': return cu2pl(expand_cu(text)) else: return el2pl(simplify_el(text))
def metaphone_el(word, **kwargs): word = word.replace('=', '') word = word.replace('_', '') word = simplify_el(word) m = re.match('[^\w]*([0-9]+)[^\w]*', word) if m: return "#" + m.group(1) if any(word.endswith(suffix) for suffix in ['εν', 'ον']): word = word[:-1] return metaphone_generic(pairs_el, word, 'el', **kwargs)