def _plenum_parsePara(txt,t,titles):
    if titles is None:
        titles=[]
        if t=='speaker':
            titles.append({u't':u'',u'c':[
                {u't':txt,u'c':[],u's':1}
            ]})
        elif t=='title':
            titles.append({u't':txt,u'c':[]})
        else:
            titles.append({u't':'',u'c':[
                {u't':txt,u's':0}
            ]})
    elif t=='title':
        titles.append({u't':txt,u'c':[]})
    else:
        title=titles[len(titles)-1]
        children=title['c']
        if t=='speaker':
            children.append({u't':txt,u'c':[],u's':1})
        elif len(children)==0:
            children.append({u't':txt,u's':0})
        elif children[len(children)-1]['s']==1:
            children[len(children)-1]['c'].append({u't':txt})
        else:
            children.append({u't':txt,u's':0})
    return titles
dataset/ETHPy150Open ofri/Open-Knesset/plenum/create_protocol_parts.py/_plenum_parsePara/original