nltk.chunk.api module

class nltk.chunk.api.ChunkParserI[source]

Bases: ParserI

A processing interface for identifying non-overlapping groups in unrestricted text. Typically, chunk parsers are used to find base syntactic constituents, such as base noun phrases. Unlike ParserI, ChunkParserI guarantees that the parse() method will always generate a parse.

accuracy(gold)[source]

Score the accuracy of the chunker against the gold standard. Remove the chunking the gold standard text, rechunk it using the chunker, and return a ChunkScore object reflecting the performance of this chunk parser.

Parameters:

gold (list(Tree)) – The list of chunked sentences to score the chunker on.

Return type:

ChunkScore

evaluate(**kwargs)

@deprecated: Use accuracy(gold) instead.

parse(tokens)[source]

Return the best chunk structure for the given tokens and return a tree.

Parameters:

tokens (list(tuple)) – The list of (word, tag) tokens to be chunked.

Return type:

Tree