3
­dš  ã               @   s8   d dl mZ d dlmZ d dlmZ G dd„ deƒZdS )é    )Ú
ChunkScore)Ú
deprecated)ÚParserIc               @   s0   e Zd ZdZdd„ Zedƒdd„ ƒZdd„ Zd	S )
ÚChunkParserIa;  
    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.
    c             C   s
   t ƒ ‚dS )zÞ
        Return the best chunk structure for the given tokens
        and return a tree.

        :param tokens: The list of (word, tag) tokens to be chunked.
        :type tokens: list(tuple)
        :rtype: Tree
        N)ÚNotImplementedError)ÚselfÚtokens© r	   ú./tmp/pip-build-v9q4h5k9/nltk/nltk/chunk/api.pyÚparse   s    	zChunkParserI.parsezUse accuracy(gold) instead.c             C   s
   | j |ƒS )N)Úaccuracy)r   Úgoldr	   r	   r
   Úevaluate&   s    zChunkParserI.evaluatec             C   s.   t ƒ }x"|D ]}|j|| j|jƒ ƒƒ qW |S )a‹  
        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.

        :type gold: list(Tree)
        :param gold: The list of chunked sentences to score the chunker on.
        :rtype: ChunkScore
        )r   Zscorer   Zleaves)r   r   Z
chunkscoreÚcorrectr	   r	   r
   r   *   s    
zChunkParserI.accuracyN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r	   r	   r	   r
   r      s   r   N)Znltk.chunk.utilr   Znltk.internalsr   Z
nltk.parser   r   r	   r	   r	   r
   Ú<module>   s   