nltk.chunk.tagstr2tree¶
- nltk.chunk.tagstr2tree(s, chunk_label='NP', root_label='S', sep='/', 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 formtext/tag
. Words that do not contain a slash are assigned atag
of None.- Parameters
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