nltk.chunk.conllstr2tree

nltk.chunk.conllstr2tree(s, chunk_types=('NP', 'PP', 'VP'), root_label='S')[source]

Return a chunk structure for a single sentence encoded in the given CONLL 2000 style string. This function converts a CoNLL IOB string into a tree. It uses the specified chunk types (defaults to NP, PP and VP), and creates a tree rooted at a node labeled S (by default).

Parameters
  • s (str) – The CoNLL string to be converted.

  • chunk_types (tuple) – The chunk types to be converted.

  • root_label (str) – The node label to use for the root.

Return type

Tree