nltk.chunk.tagstr2tree(s, chunk_label=u'NP', root_label=u'S', sep=u'/', source_tagset=None, target_tagset=None)[source]

Divide a string of bracketted tagged text into chunks and unchunked tokens, and produce a Tree. Chunks are marked by square brackets ([...]). Words are delimited by whitespace, and each word should have the form text/tag. Words that do not contain a slash are assigned a tag of None.

  • s (str) – The string to be converted
  • chunk_label (str) – The label to use for chunk nodes
  • root_label (str) – The label to use for the root of the tree
Return type: