Exemplo n.º 1
0
    class Hyphenator(object):
        def __init__(self, language):
            self.pyphen = Pyphen(lang=language)

        def syllables(self, word):
            word = word.decode("utf-8")
            syllables = list(self.pyphen.iterate(word))
            if not syllables:
                syllables = [word]
            return syllables
Exemplo n.º 2
0
def Morphemes(s_word, lang, measures):
    di = Pyphen(lang=lang)
    morphemes = []
    for pair in di.iterate(s_word):
        morphemes.append(pair)

    if len(morphemes) != 0:
        measures["morphemes"] = morphemes
        measures["morphemes_count"] = len(morphemes[0])
    else:
        measures["morphemes"] = "Not Found"
        measures["morphemes_count"] = 0