You can do this a couple of different ways (at least):
1. Use term vectors. See http://www.cnlp.org/apachecon2005 for an
intro, search on this list, or look in Erik and Otis book Lucene In
Action. This will be the fastest way, but will require more space in
your index to store the term vectors.
2. Iterate over the TermDocs interface. See IndexReader.termDocs()
method for how to get an instance.
Mary S wrote:
Hi,
I want to get the freq of a term in a Doc.
public int termFreq( int docID, String termName ) {
IndexReader reader = IndexReader.open(directory);
Document doc = reader.document(docID);
int FreqForTerm = doc.... ???
return FreqForTerm;
}
I didn't find what I want in the archives.
Can someone please assist?
Mary
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Grant Ingersoll
Sr. Software Engineer
Center for Natural Language Processing
Syracuse University
School of Information Studies
335 Hinds Hall
Syracuse, NY 13244
http://www.cnlp.org
Voice: 315-443-5484
Fax: 315-443-6886
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]