nltk.parse.DependencyGraph

class nltk.parse.DependencyGraph(tree_str=None, cell_extractor=None, zero_based=False, cell_separator=None, top_relation_label=u'ROOT')[source]

A container for the nodes and labelled edges of a dependency structure.

Methods

__init__([tree_str, cell_extractor, ...]) Dependency graph.
add_arc(head_address, mod_address) Adds an arc from the node specified by head_address to the node specified by the mod address.
add_node(node)
connect_graph() Fully connects all non-root nodes.
contains_address(node_address) Returns true if the graph contains a node with the given node address, false otherwise.
contains_cycle() Check whether there are cycles.
get_by_address(node_address) Return the node with the given address.
get_cycle_path(curr_node, goal_node_index)
left_children(node_index) Returns the number of left children under the node specified by the given address.
load(filename[, zero_based, cell_separator, ...])
param filename:a name of a file in Malt-TAB format
nx_graph() Convert the data in a nodelist into a networkx labeled directed graph.
redirect_arcs(originals, redirect) Redirects arcs to any of the nodes in the originals list to the redirect node address.
remove_by_address(address) Removes the node with the given address.
right_children(node_index) Returns the number of right children under the node specified by the given address.
to_conll(style) The dependency graph in CoNLL format.
to_dot() Return a dot representation suitable for using with Graphviz.
tree() Starting with the root node, build a dependency tree using the NLTK Tree constructor.
triples([node]) Extract dependency triples of the form:
unicode_repr()