nltk.ProbabilisticNonprojectiveParser.collapse_nodes

ProbabilisticNonprojectiveParser.collapse_nodes(new_node, cycle_path, g_graph, b_graph, c_graph)[source]

Takes a list of nodes that have been identified to belong to a cycle, and collapses them into on larger node. The arcs of all nodes in the graph must be updated to account for this.

Parameters:
  • new_node (Node.) – A Node (Dictionary) to collapse the cycle nodes into.
  • cycle_path (A list of integers.) – A list of node addresses, each of which is in the cycle.
  • b_graph, c_graph (g_graph,) – Graphs which need to be updated.