
    g                     <    d Z ddlmZ  G d d      Z G d d      Zy)a  
Interfaces for labeling tokens with category labels (or "class labels").

``ClassifierI`` is a standard interface for "single-category
classification", in which the set of categories is known, the number
of categories is finite, and each text belongs to exactly one
category.

``MultiClassifierI`` is a standard interface for "multi-category
classification", which is like single-category classification except
that each text belongs to zero or more categories.
    )
overriddenc                   .    e Zd ZdZd Zd Zd Zd Zd Zy)ClassifierIa  
    A processing interface for labeling tokens with a single category
    label (or "class").  Labels are typically strs or
    ints, but can be any immutable type.  The set of labels
    that the classifier chooses from must be fixed and finite.

    Subclasses must define:
      - ``labels()``
      - either ``classify()`` or ``classify_many()`` (or both)

    Subclasses may define:
      - either ``prob_classify()`` or ``prob_classify_many()`` (or both)
    c                     t               zs
        :return: the list of category labels used by this classifier.
        :rtype: list of (immutable)
        NotImplementedErrorselfs    F/var/www/openai/venv/lib/python3.12/site-packages/nltk/classify/api.pylabelszClassifierI.labels+       
 "##    c                 j    t        | j                        r| j                  |g      d   S t               )ze
        :return: the most appropriate label for the given featureset.
        :rtype: label
        r   r   classify_manyr	   r   
featuresets     r   classifyzClassifierI.classify2   3    
 d(()%%zl3A66%''r   c                 j    t        | j                        r| j                  |g      d   S t               )z
        :return: a probability distribution over labels for the given
            featureset.
        :rtype: ProbDistI
        r   r   prob_classify_manyr	   r   s     r   prob_classifyzClassifierI.prob_classify<   3     d--.**J<8;;%''r   c                 J    |D cg c]  }| j                  |       c}S c c}w )z
        Apply ``self.classify()`` to each element of ``featuresets``.  I.e.:

            return [self.classify(fs) for fs in featuresets]

        :rtype: list(label)
        r   r   featuresetsfss      r   r   zClassifierI.classify_manyG   %     -88Kbb!K888    c                 J    |D cg c]  }| j                  |       c}S c c}w z
        Apply ``self.prob_classify()`` to each element of ``featuresets``.  I.e.:

            return [self.prob_classify(fs) for fs in featuresets]

        :rtype: list(ProbDistI)
        r   r   s      r   r   zClassifierI.prob_classify_manyQ   '     2==2""2&===r"   N	__name__
__module____qualname____doc__r   r   r   r   r    r   r   r   r           $(	(9>r   r   c                   .    e Zd ZdZd Zd Zd Zd Zd Zy)MultiClassifierIa  
    A processing interface for labeling tokens with zero or more
    category labels (or "labels").  Labels are typically strs
    or ints, but can be any immutable type.  The set of labels
    that the multi-classifier chooses from must be fixed and finite.

    Subclasses must define:
      - ``labels()``
      - either ``classify()`` or ``classify_many()`` (or both)

    Subclasses may define:
      - either ``prob_classify()`` or ``prob_classify_many()`` (or both)
    c                     t               r   r   r
   s    r   r   zMultiClassifierI.labelsk   r   r   c                 j    t        | j                        r| j                  |g      d   S t               )zr
        :return: the most appropriate set of labels for the given featureset.
        :rtype: set(label)
        r   r   r   s     r   r   zMultiClassifierI.classifyr   r   r   c                 j    t        | j                        r| j                  |g      d   S t               )z
        :return: a probability distribution over sets of labels for the
            given featureset.
        :rtype: ProbDistI
        r   r   r   s     r   r   zMultiClassifierI.prob_classify|   r   r   c                 J    |D cg c]  }| j                  |       c}S c c}w )z
        Apply ``self.classify()`` to each element of ``featuresets``.  I.e.:

            return [self.classify(fs) for fs in featuresets]

        :rtype: list(set(label))
        r   r   s      r   r   zMultiClassifierI.classify_many   r!   r"   c                 J    |D cg c]  }| j                  |       c}S c c}w r$   r%   r   s      r   r   z#MultiClassifierI.prob_classify_many   r&   r"   Nr'   r,   r   r   r/   r/   \   r-   r   r/   N)r+   nltk.internalsr   r   r/   r,   r   r   <module>r6      s$    &=> =>@=> =>r   