def natural_breaks(sonnet):
    all_words = []
    for line in sonnet:
        all_words += line
    
    for i in range(len(all_words)):
        if all_words[i] in ' ':
            spl = all_words[i].split(' ')
            all_words[i] = spl[0]
            for j in range(1, len(spl)):
                all_words.insert(i+j, spl[j])
        else:
            pass
    
    rhyme_locs = [rhyme_loc(w, all_words) for w in all_words]
    #slant_rhyme_locs = [slant_rhyme_loc(w, all_words) for w in all_words]
    noun_locs = noun_loc(all_words)
    
    breaks = []
    line_lengths = [len(all_words)]
    
    if any(bool(i) for i in rhyme_locs):
        for j in rhyme_locs:
            if bool(j):
                breaks += j
            else:
                pass
        breaks = sorted(list(set(breaks)))
        line_lengths = line_length_counter(breaks, all_words)
    else:
        pass
        
    #if max(line_lengths) <= len(all_words) / (len(sonnet) / 2):
    #    break
    #else:
    #    pass
    
    #if any(bool(i) for i in slant_rhyme_locs):
    #    for j in slant_rhyme_locs:
    #        if bool(j):
    #            breaks += j
    #        else:
    #            pass
    #    breaks = sorted(list(set(breaks)))
    #    line_lengths = line_length_counter(breaks, all_words)
    #else:
    #    pass
    #    
    #if max(line_lengths) <= len(all_words) / (len(sonnet) / 2):
    #    break
    #else:
    #    pass
    
    # maybe tweak this number...

    if len(breaks) <= (len(sonnet) / 2):
        breaks += noun_locs
    else:
        pass
    breaks = sorted(list(set(breaks)))
    
    #if breaks[-1] > len(all_words) - 4:
    #    breaks = breaks[:-1]
    #else:
    #    pass

    #breaks2 = []

    # diagnostic...
    #print breaks
    # ...diagnostic

    #for i in range(1, len(breaks)):
    #    if breaks[i] - breaks[i-1] >= 3:
    #        breaks2.append(breaks[i-1])
    #    else:
    #        pass

    # diagnostic...
    #print breaks
    #print breaks2
    #print all_words
    #print len(all_words)
    # ...diagnostic

    s = []
    s.append(all_words[:(breaks[0]+1)])
    for i in range(len(breaks)-1):
        s.append(all_words[breaks[i]+1:breaks[i+1]+1])
    s.append(all_words[breaks[-1]+1:len(all_words)+1])


    while len(s[-1]) > 0 and s[-1][-1] in banned_end_words:
        s[-1] = s[-1][:-1]
    if s[-1] == []:
        del s[-1]
    else:
        pass

    return s
dataset/ETHPy150Open rossgoodwin/sonnetizer/sonnetizer_n.py/natural_breaks/swapped operands of `in`