|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpitt.search.semanticvectors.LuceneUtils
public class LuceneUtils
Class to support reading extra information from Lucene indexes, including term frequency, doc frequency.
| Constructor Summary | |
|---|---|
LuceneUtils(java.lang.String path)
|
|
| Method Summary | |
|---|---|
float |
getEntropy(org.apache.lucene.index.Term term)
Gets the 1 - entropy (i.e. |
int |
getGlobalTermFreq(org.apache.lucene.index.Term term)
Gets the global term frequency of a term, i.e. |
float |
getGlobalTermWeight(org.apache.lucene.index.Term term)
Gets the global term weight for a term, used in query weighting. |
float |
getGlobalTermWeightFromString(java.lang.String termString)
This is a hacky wrapper to get an approximate term weight for a string. |
int |
getNumDocs()
Gets the number of documents |
protected boolean |
termFilter(org.apache.lucene.index.Term term,
java.lang.String[] desiredFields,
int nonAlphabet,
int minFreq)
Filters out non-alphabetic terms and those of low frequency |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LuceneUtils(java.lang.String path)
throws java.io.IOException
path - - path to lucene index
java.io.IOException| Method Detail |
|---|
public int getGlobalTermFreq(org.apache.lucene.index.Term term)
term - whose frequency you want
public float getGlobalTermWeightFromString(java.lang.String termString)
public float getGlobalTermWeight(org.apache.lucene.index.Term term)
term - whose frequency you want
public int getNumDocs()
public float getEntropy(org.apache.lucene.index.Term term)
term - whose entropy you want
Thanks to Vidya Vasuki for adding the hash table to
eliminate redundant calculation
protected boolean termFilter(org.apache.lucene.index.Term term,
java.lang.String[] desiredFields,
int nonAlphabet,
int minFreq)
throws java.io.IOException
term - - Term to be filtered.desiredFields - - Terms in only these fields are filtered innonAlphabet - - number of allowed non-alphabetic characters in the term
-1 if we want no character filteringminFreq - - min global frequency allowed
Thanks to Vidya Vasuki for refactoring and bug repair
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||