Пример #1
0
            print(tree_name, anchor)
            raise NotImplementedError

        node_dict = sem_map[key]
        for node_label, (sem_str, var_str) in node_dict.items():
            sem_str = sem_str(anchor)
            node = tree.find(node_label)
            node.semantics = SemanticParser.parse(sem_str)
            var, rest = VariableParser.parse(var_str)
            node.sem_var = var

        return tree

if __name__ == '__main__':
    g = Grammar.load()
    vnet = VerbNet.load()
    mapper = XTAGMapper.load()
    propbank = Propbank.load()
    s = SemTreeGrammar(g, vnet, mapper, propbank)

    jump = s.get_semtree('alphanx0Vnx1', 'jumped', lemma='run')
    tree_families = set(mapper.xtag_mapping.values())
    all_trees = set()
    for tf in tree_families:
        all_trees.update([t.tree_name for t in g.get_trees_from_tree_family(tf)])
        print(tf)
    #for tree_name in sorted(all_trees):
    #    print(tree_name)

    '''
    chase_ps = s.get_semtree('alphanx0Vnx1', 'jump', lemma='run')
Пример #2
0
 def vnet(cls):
     return VerbNet.load()