public class NGramFingerPrint
extends java.util.Hashtable<java.lang.String,java.lang.Integer>
Constructor and Description |
---|
NGramFingerPrint() |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Integer> |
categorize(java.util.Collection<NGramFingerPrint> categories)
categorizes the FingerPrint by computing the distance to the FingerPrints
in the passed Collection. the category of the FingerPrint with the lowest
distance is assigned to this FingerPrint.
|
void |
create(java.lang.String text)
fills the FingerPrint with all the NGrams and their numer of occurences in
the passed text.
|
java.lang.String |
getCategory()
returns the category of the FingerPrint or "unknown" if the FingerPrint
wasn't categorized yet.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getCategoryDistances() |
int |
getPosition(java.lang.String key)
gets the position of the NGram passed to method in the FingerPrint. the
NGrams are in descending order according to the number of occurences in the
text which was used creating the FingerPrint.
|
void |
load(java.lang.String ngram) |
protected void |
setCategory(java.lang.String category)
sets the category of the FingerPrint
|
java.lang.String |
toString()
returns the FingerPrint as a String in the FingerPrint file-format
|
public void load(java.lang.String ngram)
public void create(java.lang.String text)
text
- text to be analysedpublic java.util.Map<java.lang.String,java.lang.Integer> categorize(java.util.Collection<NGramFingerPrint> categories)
categories
- public java.util.Map<java.lang.String,java.lang.Integer> getCategoryDistances()
public int getPosition(java.lang.String key)
key
- the NGrampublic java.lang.String getCategory()
public java.lang.String toString()
toString
in class java.util.Hashtable<java.lang.String,java.lang.Integer>
protected void setCategory(java.lang.String category)
category
- the categoryCopyright © 2001-2010 Jalios SA. All Rights Reserved.