def CTB_parse_main(sen,tag_models,pcfg_model): #tag_model_class, sentence ##split to pieces## pieces=split_sen(sen) ##piece parse## kbest=piece_parsed_main_sen(pieces,tag_models[0],pcfg_model) #return tl ##piece joint## tree=get_piece_joint(kbest,tag_models[1],pcfg_model) #return tl #return (pieces,tl,tree) return tree
def CTB_parse_main(sen,tag_models,pcfg_model): #tag_model_class, sentence ##split to pieces## pieces=split_sen(sen) #print len(pieces) ##piece parse## kbest=piece_parsed_main_sen(pieces,tag_models[0],pcfg_model) #return tl ##piece joint## trees=get_piece_joint(kbest,tag_models[1],pcfg_model) res=[] for node in trees: #transfer into root r=root() r.son=[node[0]] r.head=node[0].head #head r.head_pos=node[0].head_pos res.append([r,node[1]]) #return tl #return (pieces,tl,tree) return res