Ejemplo n.º 1
0
    for chunk in chunk_list:

        comprange = (chunk[0][0], chunk[-1][0] + 1)
        simprange = (chunk[0][1], chunk[-1][1] + 1)
        if DEBUG:
            print 'comprange of chunk', chunk, '...'
            print comprange
            print 'simprange ...'
            print simprange
        compposition = comptree.treeposition_spanning_leaves(
            comprange[0], comprange[1])
        simpposition = simptree.treeposition_spanning_leaves(
            simprange[0], simprange[1])
        if DEBUG:
            print 'derived comp subtree ...'
            print comptree.root()[compposition]
            print 'derived simp subtree ...'
            print simptree.root()[simpposition]
            #print comptree.leaves()[comprange[1]-1]
            if not isinstance(comptree.root()[compposition],
                              str) and not isinstance(
                                  simptree.root()[simpposition], str):
                if len(ParentedTree(comptree.root()[compposition].pprint()).leaves()) != comprange[1]-comprange[0] or \
                        len(ParentedTree(simptree.root()[simpposition].pprint()).leaves()) != simprange[1]-simprange[0]:
                    raw_input('mah tree is too big! ')
        if compposition == (0, ) and comptree.pos()[comprange[1] -
                                                    1][0] == '.':
            #capture adjuncts that are beside EOS punctuation ...
            #BUT, NOT NECESSARILY ADJUNCTS ... COULD BE PP ARG, OR NP AT EOS
            #print 'we got it'
            compadjpos = comptree.treeposition_spanning_leaves(