public final class DirectCandidateGenerator extends CandidateGenerator
Modifier and Type | Class and Description |
---|---|
static class |
DirectCandidateGenerator.Candidate |
static class |
DirectCandidateGenerator.CandidateSet |
static class |
DirectCandidateGenerator.TokenConsumer |
Constructor and Description |
---|
DirectCandidateGenerator(org.apache.lucene.search.spell.DirectSpellChecker spellchecker,
java.lang.String field,
org.apache.lucene.search.spell.SuggestMode suggestMode,
org.apache.lucene.index.IndexReader reader,
double nonErrorLikelihood,
int numCandidates) |
DirectCandidateGenerator(org.apache.lucene.search.spell.DirectSpellChecker spellchecker,
java.lang.String field,
org.apache.lucene.search.spell.SuggestMode suggestMode,
org.apache.lucene.index.IndexReader reader,
double nonErrorLikelihood,
int numCandidates,
org.apache.lucene.analysis.Analyzer preFilter,
org.apache.lucene.analysis.Analyzer postFilter,
org.apache.lucene.index.Terms terms) |
Modifier and Type | Method and Description |
---|---|
static int |
analyze(org.apache.lucene.analysis.Analyzer analyzer,
org.apache.lucene.util.BytesRef toAnalyze,
java.lang.String field,
DirectCandidateGenerator.TokenConsumer consumer,
org.apache.lucene.util.CharsRefBuilder spare) |
static int |
analyze(org.apache.lucene.analysis.TokenStream stream,
DirectCandidateGenerator.TokenConsumer consumer)
NOTE: this method closes the TokenStream, even on exception, which is awkward
because really the caller who called
Analyzer.tokenStream(java.lang.String, java.io.Reader) should close it,
but when trying that there are recursion issues when we try to use the same
TokenStream twice in the same recursion... |
DirectCandidateGenerator.Candidate |
createCandidate(org.apache.lucene.util.BytesRef term,
long frequency,
double channelScore,
boolean userInput) |
DirectCandidateGenerator.CandidateSet |
drawCandidates(DirectCandidateGenerator.CandidateSet set) |
long |
frequency(org.apache.lucene.util.BytesRef term) |
java.lang.String |
getField() |
long |
internalFrequency(org.apache.lucene.util.BytesRef term) |
boolean |
isKnownWord(org.apache.lucene.util.BytesRef term) |
protected void |
postFilter(DirectCandidateGenerator.Candidate candidate,
org.apache.lucene.util.CharsRefBuilder spare,
org.apache.lucene.util.BytesRefBuilder byteSpare,
java.util.List<DirectCandidateGenerator.Candidate> candidates) |
protected org.apache.lucene.util.BytesRef |
preFilter(org.apache.lucene.util.BytesRef term,
org.apache.lucene.util.CharsRefBuilder spare,
org.apache.lucene.util.BytesRefBuilder byteSpare) |
protected long |
thresholdFrequency(long termFrequency,
long dictionarySize) |
createCandidate, createCandidate, drawCandidates
public DirectCandidateGenerator(org.apache.lucene.search.spell.DirectSpellChecker spellchecker, java.lang.String field, org.apache.lucene.search.spell.SuggestMode suggestMode, org.apache.lucene.index.IndexReader reader, double nonErrorLikelihood, int numCandidates) throws java.io.IOException
java.io.IOException
public DirectCandidateGenerator(org.apache.lucene.search.spell.DirectSpellChecker spellchecker, java.lang.String field, org.apache.lucene.search.spell.SuggestMode suggestMode, org.apache.lucene.index.IndexReader reader, double nonErrorLikelihood, int numCandidates, org.apache.lucene.analysis.Analyzer preFilter, org.apache.lucene.analysis.Analyzer postFilter, org.apache.lucene.index.Terms terms) throws java.io.IOException
java.io.IOException
public boolean isKnownWord(org.apache.lucene.util.BytesRef term) throws java.io.IOException
isKnownWord
in class CandidateGenerator
java.io.IOException
public long frequency(org.apache.lucene.util.BytesRef term) throws java.io.IOException
frequency
in class CandidateGenerator
java.io.IOException
public long internalFrequency(org.apache.lucene.util.BytesRef term) throws java.io.IOException
java.io.IOException
public java.lang.String getField()
public DirectCandidateGenerator.CandidateSet drawCandidates(DirectCandidateGenerator.CandidateSet set) throws java.io.IOException
drawCandidates
in class CandidateGenerator
java.io.IOException
protected org.apache.lucene.util.BytesRef preFilter(org.apache.lucene.util.BytesRef term, org.apache.lucene.util.CharsRefBuilder spare, org.apache.lucene.util.BytesRefBuilder byteSpare) throws java.io.IOException
java.io.IOException
protected void postFilter(DirectCandidateGenerator.Candidate candidate, org.apache.lucene.util.CharsRefBuilder spare, org.apache.lucene.util.BytesRefBuilder byteSpare, java.util.List<DirectCandidateGenerator.Candidate> candidates) throws java.io.IOException
java.io.IOException
protected long thresholdFrequency(long termFrequency, long dictionarySize)
public DirectCandidateGenerator.Candidate createCandidate(org.apache.lucene.util.BytesRef term, long frequency, double channelScore, boolean userInput) throws java.io.IOException
createCandidate
in class CandidateGenerator
java.io.IOException
public static int analyze(org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.util.BytesRef toAnalyze, java.lang.String field, DirectCandidateGenerator.TokenConsumer consumer, org.apache.lucene.util.CharsRefBuilder spare) throws java.io.IOException
java.io.IOException
public static int analyze(org.apache.lucene.analysis.TokenStream stream, DirectCandidateGenerator.TokenConsumer consumer) throws java.io.IOException
Analyzer.tokenStream(java.lang.String, java.io.Reader)
should close it,
but when trying that there are recursion issues when we try to use the same
TokenStream twice in the same recursion...java.io.IOException