nltk.ParentedTree.chomsky_normal_form

ParentedTree.chomsky_normal_form(factor=u'right', horzMarkov=None, vertMarkov=0, childChar=u'|', parentChar=u'^')

This method can modify a tree in three ways:

  1. Convert a tree into its Chomsky Normal Form (CNF) equivalent – Every subtree has either two non-terminals or one terminal as its children. This process requires the creation of more”artificial” non-terminal nodes.
  2. Markov (vertical) smoothing of children in new artificial nodes
  3. Horizontal (parent) annotation of nodes
Parameters:
  • factor (str = [left|right]) – Right or left factoring method (default = “right”)
  • horzMarkov (int | None) – Markov order for sibling smoothing in artificial nodes (None (default) = include all siblings)
  • vertMarkov (int | None) – Markov order for parent smoothing (0 (default) = no vertical annotation)
  • childChar (str) – A string used in construction of the artificial nodes, separating the head of the original subtree from the child nodes that have yet to be expanded (default = “|”)
  • parentChar (str) – A string used to separate the node representation from its vertical annotation