def sylcount(s):
    try:
        d[s]
    except KeyError:
        return None
    else:
        if len(d[s]) <= 1:
            sj = ''.join(d[s][0])
            sl = re.split('0|1|2', sj)
            return len(sl) - 1
        else:
            sj0 = ''.join(d[s][0])
            sl0 = re.split('0|1|2', sj0)
            sj1 = ''.join(d[s][1])
            sl1 = re.split('0|1|2', sj1)
            if len(sl1) < len(sl0):
                return len(sl1) - 1
            else:
                return len(sl0) - 1
dataset/ETHPy150Open rossgoodwin/sonnetizer/sonnetizer_n.py/sylcount/original