public class SoftTFIDFDictionary extends Object implements FastLookup
For example:
SoftTFIDFDictionary dict = new SoftTFIDFDictionary();
dict.put("william cohen", "wcohen@cs.cmu.edu");
dict.put("vitor del rocha carvalho", "vitor@cs.cmu.edu");
...
dict.freeze();
int n=dict.lookup("victor carvalho");
for (int i=0; i
| Modifier and Type | Field and Description |
|---|---|
protected double |
lookupTime |
| Constructor and Description |
|---|
SoftTFIDFDictionary() |
SoftTFIDFDictionary(Tokenizer tokenizer) |
SoftTFIDFDictionary(Tokenizer tokenizer,
double minTokenSimilarity) |
SoftTFIDFDictionary(Tokenizer tokenizer,
double minTokenSimilarity,
int windowSize,
int maxInvertedIndexSize)
Create a new SoftTFIDFDictionary.
|
| Modifier and Type | Method and Description |
|---|---|
void |
freeze()
Make it impossible to add new values, but possible to perform lookups.
|
double |
getLookupTime()
Get the time used in performing the lookup
|
int |
getMaxInvertedIndexSize() |
String |
getResult(int i)
Get the i'th string found by the last lookup
|
double |
getScore(int i)
Get the score of the i'th string found by the last lookup
|
Object |
getValue(int i)
Get the value of the i'th string found by the last lookup
|
int |
getWindowSize(int w) |
void |
loadAliases(File file)
Load a file of identifiers, each of which has multiple
aliases.
|
int |
lookup(double minScore,
String toFind)
Lookup items SoftTFIDF-similar to the 'toFind' argument, and
return the number of items found.
|
static void |
main(String[] argv)
Simple main for testing and experimentation
|
void |
put(String string,
Object value)
Insert a string into the dictionary, and associate it with the
given value.
|
void |
refreeze() |
static SoftTFIDFDictionary |
restore(File file) |
void |
saveAs(File file) |
void |
setMaxInvertedIndexSize(int m)
Set the maximum size of an inverted index that will be
followed.
|
void |
setWindowSize(int w)
Set the 'windowSize' used for finding similar tokens.
|
int |
slowLookup(double minScore,
String toFind)
Exactly like lookup, but works by exhaustively checking every stored string.
|
public SoftTFIDFDictionary()
public SoftTFIDFDictionary(Tokenizer tokenizer)
public SoftTFIDFDictionary(Tokenizer tokenizer, double minTokenSimilarity)
public SoftTFIDFDictionary(Tokenizer tokenizer, double minTokenSimilarity, int windowSize, int maxInvertedIndexSize)
public void saveAs(File file) throws IOException, FileNotFoundException
IOExceptionFileNotFoundExceptionpublic static SoftTFIDFDictionary restore(File file) throws IOException, FileNotFoundException
IOExceptionFileNotFoundExceptionpublic void setWindowSize(int w)
public int getWindowSize(int w)
public void setMaxInvertedIndexSize(int m)
public int getMaxInvertedIndexSize()
public void loadAliases(File file) throws IOException, FileNotFoundException
IOExceptionFileNotFoundExceptionpublic void put(String string, Object value)
public void refreeze()
public void freeze()
public int slowLookup(double minScore,
String toFind)
public int lookup(double minScore,
String toFind)
lookup in interface FastLookuppublic String getResult(int i)
getResult in interface FastLookuppublic Object getValue(int i)
getValue in interface FastLookuppublic double getScore(int i)
getScore in interface FastLookuppublic double getLookupTime()
public static void main(String[] argv) throws IOException, FileNotFoundException, NumberFormatException, ClassNotFoundException
Copyright © 2016. All rights reserved.