Package nltk :: Package chunk :: Module api
[hide private]
[frames] | no frames]

Source Code for Module nltk.chunk.api

 1  # Natural Language Toolkit: Chunk parsing API 
 2  # 
 3  # Copyright (C) 2001-2008 NLTK Project 
 4  # Author: Edward Loper <[email protected]> 
 5  #         Steven Bird <[email protected]> (minor additions) 
 6  # URL: <http://nltk.org> 
 7  # For license information, see LICENSE.TXT 
 8   
 9  ##////////////////////////////////////////////////////// 
10  ##  Chunk Parser Interface 
11  ##////////////////////////////////////////////////////// 
12   
13  from nltk.parse import ParserI 
14   
15 -class ChunkParserI(ParserI):
16 """ 17 A processing interface for identifying non-overlapping groups in 18 unrestricted text. Typically, chunk parsers are used to find base 19 syntactic constituants, such as base noun phrases. Unlike 20 L{ParserI}, C{ChunkParserI} guarantees that the C{parse} method 21 will always generate a parse. 22 """
23 - def parse(self, tokens):
24 """ 25 @return: the best chunk structure for the given tokens 26 and return a tree. 27 28 @param tokens: The list of (word, tag) tokens to be chunked. 29 @type tokens: C{list} of L{tuple} 30 @rtype: L{Tree} 31 """ 32 assert 0, "ChunkParserI is an abstract interface"
33