def line_rhymer(sonnet, line_numbers):
    origin_word = sonnet[line_numbers[0]][-1]
    candidate_count = len(line_numbers) - 1
    if len(rhyme_dict[origin_word]) >= candidate_count:
        pass
    else:
        new_owc = []
        for i in range(candidate_count, max(rhyme_counts)+1):
            new_owc += rhyme_freq[i]
        origin_word = random.choice(new_owc)
        sonnet[line_numbers[0]][-1] = origin_word
    rhyming_words = random.sample(rhyme_dict[origin_word], candidate_count)
    for i in range(candidate_count):
        sonnet[line_numbers[i+1]][-1] = rhyming_words[i]
    return sonnet
dataset/ETHPy150Open rossgoodwin/sonnetizer/sonnetizer_n.py/line_rhymer/original