def rhymer(sonnet):
    rs_list = [i for i in rhyme_scheme]
    rs_u = unique(rs_list)
    rs_u_n = []
    rs_u_l = []
    for des in rs_u:
        try:
            int(des)
        except ValueError:
            rs_u_l.append(des)
        else:
            rs_u_n.append(des)
    rs_n_loc = [[] for i in rs_u_n]
    locations = [[] for i in rs_u_l]
    for i in range(len(rs_u_l)):
        for j in range(len(rs_list)):
            if rs_u_l[i] == rs_list[j]:
                locations[i].append(j)
            else:
                pass
    for n in range(len(rs_u_n)):
        for m in range(len(rs_list)):
            if rs_u_n[n] == rs_list[m]:
                rs_n_loc[n].append(m)
            else:
                pass
    for x in locations:
        if len(x) <= 1:
            pass
        else:
            sonnet = line_rhymer(sonnet, x)
    for y in rs_n_loc:
        if len(y) <= 1:
            pass
        else:
            sonnet = line_repeater(sonnet, y)
    return sonnet
dataset/ETHPy150Open rossgoodwin/sonnetizer/sonnetizer_n.py/rhymer/original