
    kh                         d Z ddlmZmZ ddlZ G d de      Z G d de      Z G d	 d
ej                  j                  j                  e      Z
dZdZ G d de      Z G d de      Zy)zAbstract base classes for models (taggers, noun phrase extractors, etc.)
which define the interface for descendant classes.

.. versionchanged:: 0.7.0
    All base classes are defined in the same module, ``textblob.base``.
    )ABCMetaabstractmethodNc                   "    e Zd ZdZedd       Zy)
BaseTaggerzzAbstract tagger class from which all taggers
    inherit from. All descendants must implement a
    ``tag()`` method.
    c                      y)znReturn a list of tuples of the form (word, tag)
        for a given set of text or BaseBlob instance.
        N )selftexttokenizes      I/opt/mcp/mcp-sentiment/venv/lib/python3.12/site-packages/textblob/base.pytagzBaseTagger.tag   s    
 	    N)T)__name__
__module____qualname____doc__r   r   r   r   r   r   r      s    
  r   r   )	metaclassc                        e Zd ZdZed        Zy)BaseNPExtractorzAbstract base class from which all NPExtractor classes inherit.
    Descendant classes must implement an ``extract(text)`` method
    that returns a list of noun phrases as strings.
    c                      y)z;Return a list of noun phrases (strings) for a body of text.Nr   r	   r
   s     r   extractzBaseNPExtractor.extract&        	r   N)r   r   r   r   r   r   r   r   r   r   r       s    
  r   r   c                   &    e Zd ZdZed        Zd Zy)BaseTokenizerzAbstract base class from which all Tokenizer classes inherit.
    Descendant classes must implement a ``tokenize(text)`` method
    that returns a list of noun phrases as strings.
    c                      y)zTReturn a list of tokens (strings) for a body of text.

        :rtype: list
        Nr   r   s     r   r   zBaseTokenizer.tokenize5   s     	r   c                 <    d  | j                   |g|i |D        S )zzReturn a generator that generates tokens "on-demand".

        .. versionadded:: 0.6.0

        :rtype: generator
        c              3       K   | ]  }|  y w)Nr   ).0ts     r   	<genexpr>z*BaseTokenizer.itokenize.<locals>.<genexpr>D   s     @a@s   )r   )r	   r
   argskwargss       r   	itokenizezBaseTokenizer.itokenize=   s%     A=4==???@@r   N)r   r   r   r   r   r   r$   r   r   r   r   r   /   s!    
  Ar   r   dscoc                   0    e Zd ZdZeZd Zd Zed        Z	y)BaseSentimentAnalyzerzAbstract base class from which all sentiment analyzers inherit.
    Should implement an ``analyze(text)`` method which returns either the
    results of analysis.
    c                     d| _         y )NF_trainedr	   s    r   __init__zBaseSentimentAnalyzer.__init__V   s	    r   c                     d| _         y )NTr*   r,   s    r   trainzBaseSentimentAnalyzer.trainY   s	    r   c                 <    | j                   s| j                          y)zjReturn the result of of analysis. Typically returns either a
        tuple, float, or dictionary.
        N)r+   r/   r   s     r   analyzezBaseSentimentAnalyzer.analyze]   s     }}JJLr   N)
r   r   r   r   DISCRETEkindr-   r/   r   r1   r   r   r   r(   r(   N   s,    
 D  r   r(   c                        e Zd ZdZed        Zy)
BaseParserzxAbstract parser class from which all parsers inherit from. All
    descendants must implement a ``parse()`` method.
    c                      y)zParses the text.Nr   r   s     r   parsezBaseParser.parseq   r   r   N)r   r   r   r   r   r7   r   r   r   r5   r5   l   s      r   r5   )r   abcr   r   nltkr   r   r   api
TokenizerIr   r2   
CONTINUOUSr(   r5   r   r   r   <module>r=      sn    ( 
7 "	 	ADMM%%00G A6 
g <7 r   