public class PossibilityIterator extends java.lang.Object implements java.util.Iterator<RankedSpellPossibility>
Given a list of possible Spelling Corrections for multiple mis-spelled words in a query, This iterator returns Possible Correction combinations ordered by reasonable probability that such a combination will return actual hits if re-queried. This implementation simply ranks the Possible Combinations by the sum of their component ranks.
Modifier and Type | Field and Description |
---|---|
private int[] |
correctionIndex |
private boolean |
done |
private java.util.List<java.util.List<SpellCheckCorrection>> |
possibilityList |
private java.util.Iterator<RankedSpellPossibility> |
rankedPossibilityIterator |
Modifier | Constructor and Description |
---|---|
private |
PossibilityIterator() |
|
PossibilityIterator(java.util.Map<org.apache.lucene.analysis.Token,java.util.LinkedHashMap<java.lang.String,java.lang.Integer>> suggestions,
int maximumRequiredSuggestions,
int maxEvaluations)
We assume here that the passed-in inner LinkedHashMaps are already sorted
in order of "Best Possible Correction".
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
private boolean |
internalHasNext() |
private RankedSpellPossibility |
internalNext()
This method is converting the independent LinkHashMaps containing various
(silo'ed) suggestions for each mis-spelled word into individual
"holistic query corrections", aka.
|
RankedSpellPossibility |
next() |
void |
remove() |
private java.util.List<java.util.List<SpellCheckCorrection>> possibilityList
private java.util.Iterator<RankedSpellPossibility> rankedPossibilityIterator
private int[] correctionIndex
private boolean done
private PossibilityIterator()
public PossibilityIterator(java.util.Map<org.apache.lucene.analysis.Token,java.util.LinkedHashMap<java.lang.String,java.lang.Integer>> suggestions, int maximumRequiredSuggestions, int maxEvaluations)
We assume here that the passed-in inner LinkedHashMaps are already sorted in order of "Best Possible Correction".
suggestions
- private boolean internalHasNext()
private RankedSpellPossibility internalNext()
This method is converting the independent LinkHashMaps containing various (silo'ed) suggestions for each mis-spelled word into individual "holistic query corrections", aka. "Spell Check Possibility"
Rank here is the sum of each selected term's position in its respective LinkedHashMap.
public boolean hasNext()
hasNext
in interface java.util.Iterator<RankedSpellPossibility>
public RankedSpellPossibility next()
next
in interface java.util.Iterator<RankedSpellPossibility>
public void remove()
remove
in interface java.util.Iterator<RankedSpellPossibility>