def __init__(self, node, children, parent_node=None, rel=None, attrs=None, head=None): self.parent_node = parent_node self.rel = rel self.attrs = attrs self.head = head Tree.__init__(self, node, children)
def __init__(self, idTree, node_or_string, children=None): if children is None: return # see note in Tree.__init__() Tree.__init__(self, node_or_string, children) self.id = idTree terminal_nodes = self.subtrees(lambda x: isinstance(x[0], PropbankBrTerminalNode)) terminal_nodes_positions = [x[0].num for x in terminal_nodes] self.min_terminal_position = min(terminal_nodes_positions) self.max_terminal_position = max(terminal_nodes_positions)
def __init__(self, node_or_proxy, children=None, id=-1): if isinstance(node_or_proxy, CaboCha.Tree): trees = CaboChaTree.parse(node_or_proxy, True) Tree.__init__(self, 'S', trees) # 'S' stands for 'sentence' elif isinstance(node_or_proxy, CaboCha.Chunk): if children: Tree.__init__(self, 'C', children) # 'C' stands for 'chunk' if not id < 0: self.id = id self.link = node_or_proxy.link self.head = children[node_or_proxy.head_pos] self.func = children[node_or_proxy.func_pos] else: raise ValueError("expected children of this chunk..") else: if children: Tree.__init__(node_or_proxy, children) else: raise ValueError("expected children for leaves..")
def __init__(self, node, children=None): Tree.__init__(self, node, children) self._id = 0
def __init__(self, *args, **kwargs): Tree.__init__(self, *args, **kwargs) self._forest = None self._tuples = None
def __init__(self, node, children=None): Tree.__init__(self, node, children) self._id = 0 self.corpus_id = None self.corpus_id_num = None