Beispiel #1
0
def match_word(word, meter):
    if meter and meter[0] and word in unstressables:
        return None, None
    if True:
        if word == '<S>':
            return meter, None
    return match_phones(pronounce.pronounce(word), meter)
Beispiel #2
0
def get_beats(word):
    try:
        phones = pronounce.pronounce(word)
    except KeyError:
        try:
            return guesses[word]
        except KeyError:
            return None
    return segment_beats(phones)
Beispiel #3
0
def match_word(word, meter):
    if meter and meter[0] and word in unstressables:
        return None, None
    if True:
        if word == '<S>':
            return meter, None
    try:
        phones = pronounce.pronounce(word)
    except KeyError:
        return try_guess(word, meter)
    else:
        return match_phones(phones, meter)
Beispiel #4
0
def match_word(word, meter):
    if meter and meter[0] and word in unstressables:
        return None, None
    if True:
        if word == '<S>':
            return meter, None
    try:
        phones = pronounce.pronounce(word)
    except KeyError:
        return try_guess(word, meter)
    else:
        return match_phones(phones, meter)
Beispiel #5
0
def first_consonant_entropy(words):
    return entropy(Counter(first_consonant(pronounce.pronounce(word))
                           for word in words))
Beispiel #6
0
def test(s):
    return score(s.split(),
                 lambda word: first_consonant(pronounce.pronounce(word)))