class RelationsTransformator(InplaceTreeTransformator): def __init__(self): from yargy.relations.graph import TokenRelationsGraph self.relations = TokenRelationsGraph() def __call__(self, tree): for item in tree.walk(): self.visit(item) return self.relations def visit_Node(self, item): if item.relation: self.relations.add(item.relation, item.main)
def __init__(self): from yargy.relations.graph import TokenRelationsGraph self.relations = TokenRelationsGraph()