<commit_before># Natural Language Toolkit: Classifiers
#
# Copyright (C) 2001 University of Pennsylvania
# Author: <NAME> <<EMAIL>>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
#
# $Id$

"""
Processing classes and interfaces for labeling tokens with category
labels (or X{classes}).  Typically, classes are represented with
strings (such as C{'health'} or C{'sports'}); but other immutable
types (such as integers) can be used.  Classifiers can be used to
perform a wide range of classification tasks.  For example,
classifiers can be used...

  - to classify documents by topic.
  - to classify words by part of speech.
  - to classify acoustic signals by which phoneme they represent.
  - to classify sentences by their author.

L{ClassifierI} is a standard interface for X{single-category
classification}, in which:

    - There set of categories is known.
    - The number of categories is finite.
    - Each text belongs to exactly one category.

L{MultiClassifierI} is a standard interface for C{multi-category
classification}, in which:

    - There set of categories is known.
    - The number of categories is finite.
    - Each text belongs to zero or more categories.

The L{ClassifierTrainerI} and L{MultiClassifierTrainerI} classes
define standard interfaces for classifier trainers, which build
new classifiers from a given set of training data.

@group Classifier Interfaces: ClassifierI, MultiClassifierI
@group Classifier Trainer Interfaces: ClassifierTrainerI,
       MultiClassifierTrainerI
@group Helper Functions: attested_classes

@todo: Add raw_classify methods.
"""

from nltk.token import Token
from nltk.chktype import chktype as _chktype
from nltk.chktype import classeq as _classeq
import math, Numeric, types, sets

##//////////////////////////////////////////////////////
##  Classifier Interfaces
##//////////////////////////////////////////////////////

class ClassifierI:
    """
    A processing interface for labeling tokens with a single category
    label (or X{class}).  Classes are typically C{string}s or
    C{integer}s, but can be any immutable type.  The set of classes
    that the classifier chooses from must be fixed and finite.
    
    Typically, C{ClassifierI} subclasses encode specific classifier
    models; but do not include the algorithms for training the
    classifiers.  Instead, L{ClassifierTrainer}s are used to generate<commit_msg>removed unused reference to Numeric<commit_after># Natural Language Toolkit: Classifiers
#
# Copyright (C) 2001 University of Pennsylvania
# Author: <NAME> <<EMAIL>>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
#
# $Id$

"""
Processing classes and interfaces for labeling tokens with category
labels (or X{classes}).  Typically, classes are represented with
strings (such as C{'health'} or C{'sports'}); but other immutable
types (such as integers) can be used.  Classifiers can be used to
perform a wide range of classification tasks.  For example,
classifiers can be used...

  - to classify documents by topic.
  - to classify words by part of speech.
  - to classify acoustic signals by which phoneme they represent.
  - to classify sentences by their author.

L{ClassifierI} is a standard interface for X{single-category
classification}, in which:

    - There set of categories is known.
    - The number of categories is finite.
    - Each text belongs to exactly one category.

L{MultiClassifierI} is a standard interface for C{multi-category
classification}, in which:

    - There set of categories is known.
    - The number of categories is finite.
    - Each text belongs to zero or more categories.

The L{ClassifierTrainerI} and L{MultiClassifierTrainerI} classes
define standard interfaces for classifier trainers, which build
new classifiers from a given set of training data.

@group Classifier Interfaces: ClassifierI, MultiClassifierI
@group Classifier Trainer Interfaces: ClassifierTrainerI,
       MultiClassifierTrainerI
@group Helper Functions: attested_classes

@todo: Add raw_classify methods.
"""

from nltk.token import Token
from nltk.chktype import chktype as _chktype
from nltk.chktype import classeq as _classeq
import math, types, sets

##//////////////////////////////////////////////////////
##  Classifier Interfaces
##//////////////////////////////////////////////////////

class ClassifierI:
    """
    A processing interface for labeling tokens with a single category
    label (or X{class}).  Classes are typically C{string}s or
    C{integer}s, but can be any immutable type.  The set of classes
    that the classifier chooses from must be fixed and finite.
    
    Typically, C{ClassifierI} subclasses encode specific classifier
    models; but do not include the algorithms for training the
    classifiers.  Instead, L{ClassifierTrainer}s are used to generate
{'fraction_non_alphanumeric': 0.10657596371882086, 'fraction_numerical': 0.0016491445062873633, 'mean_word_length': 3.3633093525179856, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2340219', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1245, 'n_words': 576}