コード例 #1
0
ファイル: transriber.py プロジェクト: d-kz/rhyme_finder
        word_str = word_instance.word
        # check if this word is in rhyme map
        if i in words_rhymes:
            word_syllables = word_instance.word_splits
            word_str = ''
            for syllable in word_syllables:
                if syllable in words_rhymes[i]:
                    rhyme_str = words_rhymes[i][syllable]
                    word_str += get_text_in_color(syllable,
                                                  rhyme_color_map[rhyme_str])
                else:
                    word_str += syllable
        printout += word_str + ' '
        if i in newlines:
            printout += '\n'

            # print transcription
            for word_i in range(last_line_word, i + 1):
                printout += get_text_in_color(words[word_i].transcription,
                                              '#C0C0C0') + ' '
            printout += '\n'
            last_line_word = i + 1

    print printout


rhymes = l.get_rhymes()
print rhymes

print_lyrics(l.words, rhymes, l.new_lines)