com.jalios.jcms.search
Class NGramCategorizer

java.lang.Object
  extended by com.jalios.jcms.search.NGramCategorizer

public class NGramCategorizer
extends Object

TextCategorizer is able to categorize texts by computing the similarity of the FingerPrint of a text with a collection of the FingerPrints of the categories.


Constructor Summary
NGramCategorizer()
           
 
Method Summary
 String categorize(String text)
          Categorizes the text passed to it
 String categorize(String text, int limit)
          Categorizes only a certain amount of characters in the text.
 Map<String,Integer> getCategoryDistances(String text)
          Categorizes a text but returns a map containing all categories and their distances to the text.
protected  void init()
          Clears the categories-collection and fills it with the FingerPrints given in the configuration file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NGramCategorizer

public NGramCategorizer()
Method Detail

init

protected void init()
Clears the categories-collection and fills it with the FingerPrints given in the configuration file.


categorize

public String categorize(String text)
Categorizes the text passed to it

Parameters:
text - text to be categorized
Returns:
the category name given in the configuration file

categorize

public String categorize(String text,
                         int limit)
Categorizes only a certain amount of characters in the text. recommended when categorizing large texts in order to increase performance.

Parameters:
text - text to be analysed
limit - number of characters to be analysed
Returns:
the category name given in the configuration file

getCategoryDistances

public Map<String,Integer> getCategoryDistances(String text)
Categorizes a text but returns a map containing all categories and their distances to the text.

Parameters:
text - text to be categorized
Returns:
HashMap with categories as keys and distances as values


Copyright © 2001-2010 Jalios SA. All Rights Reserved.