Class DocumentCategorizerME
Maxent implementation of IDocumentCategorizer.
public class DocumentCategorizerME : IDocumentCategorizer
- Inheritance
-
DocumentCategorizerME
- Implements
- Inherited Members
Constructors
DocumentCategorizerME(DoccatModel)
Initializes the current instance with a doccat model. Default feature generation is used.
public DocumentCategorizerME(DoccatModel model)
Parameters
modelDoccatModelthe doccat model
Properties
NumberOfCategories
Gets the number of categories
public virtual int NumberOfCategories { get; }
Property Value
Methods
Categorize(string[])
Categorizes the given text.
public virtual double[] Categorize(string[] text)
Parameters
textstring[]the text to categorize
Returns
- double[]
Categorize(string[], IDictionary<string, object>)
Categorize the given text provided as tokens along with the provided extra information
public virtual double[] Categorize(string[] text, IDictionary<string, object> extraInformation)
Parameters
textstring[]text tokens to categorize
extraInformationIDictionary<string, object>additional information
Returns
- double[]
GetAllResults(double[])
Gets the name of the category associated with the given probabilities
public virtual string GetAllResults(double[] results)
Parameters
resultsdouble[]the probabilities of each category
Returns
- string
the name of the outcome
GetBestCategory(double[])
Gets the best category from previously generated outcome probabilities
public virtual string GetBestCategory(double[] outcome)
Parameters
outcomedouble[]a vector of outcome probabilities
Returns
- string
the best category string
GetCategory(int)
Gets the category at a given index
public virtual string GetCategory(int index)
Parameters
indexintthe index
Returns
- string
a category
GetIndex(string)
Gets the index of a certain category
public virtual int GetIndex(string category)
Parameters
categorystringthe category
Returns
- int
an index
ScoreMap(string[])
Returns a map in which the key is the category name and the value is the score
public virtual IDictionary<string, double> ScoreMap(string[] text)
Parameters
textstring[]the input text to classify
Returns
- IDictionary<string, double>
the score map
SortedScoreMap(string[])
Returns a map with the score as a key in ascending order. The value is a set of categories with the score. Many categories can have the same score, hence the set as value
public virtual SortedDictionary<double, ISet<string>> SortedScoreMap(string[] text)
Parameters
textstring[]the input text to classify
Returns
- SortedDictionary<double, ISet<string>>
the sorted score map
Train(string, IObjectStream<DocumentSample?>, TrainingParameters, DoccatFactory)
public static DoccatModel Train(string languageCode, IObjectStream<DocumentSample?> samples, TrainingParameters mlParams, DoccatFactory factory)
Parameters
languageCodestringsamplesIObjectStream<DocumentSample>mlParamsTrainingParametersfactoryDoccatFactory