def __init__(self, ldg=None): DependencyGraph.__init__(self) self.nodes = defaultdict(lambda: {'address': None, 'ldg': 0, 'gid': 1, #has the same value of the gid of nodes in ldg. 'lemma': None, 'head': None, 'deps': defaultdict(int), 'remaining_ops': defaultdict(list), #list(LgGraph.operator_dic.keys()), 'ctag': None, 'tag': None, 'feats': None, }) self.git_list = [1] self.nodes[0].update( {'address': 0, 'head': -1, 'ldg': 'TOP', 'gid': 1, #has the same value of the gid of nodes in ldg. 'remaining_ops': defaultdict(list), } ) if isinstance(ldg, LgGraph): self.nodes[0]['ldg'] = ldg if isinstance(ldg, GraphNet): self.nodes = ldg self.git_list = ldg.get_git_list()
def __init__(self, sent, top_relation_label): DependencyGraph.__init__(self, sent, top_relation_label=top_relation_label) self.words = [ node['word'] for i, node in sorted(self.nodes.items()) if node['tag'] != 'TOP' ]
def __init__(self, tree_str=None, cell_extractor=None, zero_based=False, cell_separator=None, top_relation_label='root'): DependencyGraph.__init__(self,tree_str, cell_extractor, zero_based, cell_separator, top_relation_label) self.nodes = defaultdict(lambda: {'address': None, 'word': None, 'lemma': None, 'ctag': None, # upostag 'tag': None, # xpostag 'feats': None, 'head': None, 'deps': defaultdict(list), 'rel': None, }) self.nodes[0].update( { 'ctag': 'TOP', 'tag': 'TOP', 'ID': 0, } )
def __init__(self, tree_str=None, cell_extractor=None, zero_based=False, cell_separator=None, top_relation_label='root'): DependencyGraph.__init__(self,tree_str, cell_extractor, zero_based, cell_separator, top_relation_label) self.nodes = defaultdict(lambda: {'address': None, 'word': None, 'lemma': None, 'ctag': None, # upostag 'tag': None, # xpostag 'feats': None, 'head': None, 'deps': defaultdict(list), 'rel': None, }) self.nodes[0].update( { 'ctag': 'TOP', 'tag': 'TOP', 'address': 0, } )