|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<java.lang.String,java.lang.Integer>
org.knallgrau.utils.textcat.FingerPrint
public class FingerPrint
Constructor Summary | |
---|---|
FingerPrint()
|
|
FingerPrint(java.io.InputStream is)
creates a FingerPrint by reading it with the passed InputStream |
|
FingerPrint(java.lang.String file)
creates a FingerPrint by reading the FingerPrint-file referenced by the passed path. |
Method Summary | |
---|---|
java.util.Map<java.lang.String,java.lang.Integer> |
categorize(java.util.Collection<FingerPrint> 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.io.File file)
creates a FingerPrint by analysing the content of the given file. |
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 |
save()
saves the fingerprint to a file named |
java.lang.String |
toString()
returns the FingerPrint as a String in the FingerPrint file-format |
Methods inherited from class java.util.Hashtable |
---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, values |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FingerPrint()
public FingerPrint(java.lang.String file)
file
- path to the FingerPrint-filepublic FingerPrint(java.io.InputStream is)
is
- InputStream for reading the FingerPrintMethod Detail |
---|
public void create(java.io.File file)
file
- file to be analysedpublic void create(java.lang.String text)
text
- text to be analysedpublic java.util.Map<java.lang.String,java.lang.Integer> categorize(java.util.Collection<FingerPrint> categories)
categories
- public java.util.Map<java.lang.String,java.lang.Integer> getCategoryDistances()
public int getPosition(java.lang.String key)
key
- the NGram
public void save()
public java.lang.String getCategory()
public java.lang.String toString()
toString
in class java.util.Hashtable<java.lang.String,java.lang.Integer>
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |