GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Re-attaching a node both in the basic tree and in the enhanced graph · Issue #112 · udapi/udapi-python Open Labels DescriptionI have repeatedly encountered the following situation: A small change is needed for a batch of nodes, such as changing the DEPREL (or both the HEAD and the DEPREL) for a node that satisfies a condition. Typically I do it directly from the commandline, using def reattach(self, node, parent, deprel): """ Changes the incoming dependency relation to a node. Makes sure that the same change is done in the basic tree and in the enhanced graph. """ if node.deps: # If the enhanced graph contains the current basic relation, remove it. # Note that the enhanced deprel may contain subtypes that are not in the basic deprel. orig_n_deps = len(node.deps) node.deps = [x for x in node.deps if x['parent'] != node.parent or re.sub(r':.*', '', x['deprel']) != node.udeprel] # Add the new basic relation to the enhanced graph only if the original one was there. if len(node.deps) < orig_n_deps: node.deps.append({'parent': parent, 'deprel': deprel}) node.parent = parent node.deprel = deprel Would it make sense to have something similar in the core code, as a method of Node? Activity
MetadataMetadataAssigneesLabelsTypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |