public class SpellingResult extends Object
Modifier and Type | Field and Description |
---|---|
static int |
NO_FREQUENCY_INFO |
Constructor and Description |
---|
SpellingResult() |
SpellingResult(Collection<Token> tokens) |
Modifier and Type | Method and Description |
---|---|
void |
add(Token token,
List<String> suggestions)
Adds a whole bunch of suggestions, and does not worry about frequency.
|
void |
add(Token token,
String suggestion,
int docFreq)
Suggestions must be added with the best suggestion first.
|
void |
addFrequency(Token token,
int docFreq)
Adds an original token with its document frequency
|
LinkedHashMap<String,Integer> |
get(Token token)
Gets the suggestions for the given token.
|
Map<Token,LinkedHashMap<String,Integer>> |
getSuggestions()
All the suggestions.
|
Map<Token,Integer> |
getTokenFrequency() |
Integer |
getTokenFrequency(Token token)
The token frequency of the input token in the collection
|
Collection<Token> |
getTokens() |
boolean |
hasTokenFrequencyInfo() |
void |
setTokens(Collection<Token> tokens) |
public static final int NO_FREQUENCY_INFO
public SpellingResult()
public SpellingResult(Collection<Token> tokens)
public void add(Token token, List<String> suggestions)
token
- The token to associate the suggestions withsuggestions
- The suggestionspublic void addFrequency(Token token, int docFreq)
token
- original tokendocFreq
- original token's document frequencypublic void add(Token token, String suggestion, int docFreq)
token
- The Token
suggestion
- The suggestion for the TokendocFreq
- The document frequencypublic LinkedHashMap<String,Integer> get(Token token)
token
- The Token
to look upNO_FREQUENCY_INFO
.
The suggestions are added in sorted order (i.e. best suggestion first) then the iterator will return the suggestions in orderpublic Integer getTokenFrequency(Token token)
token
- The tokenpublic boolean hasTokenFrequencyInfo()
public Map<Token,LinkedHashMap<String,Integer>> getSuggestions()
NO_FREQUENCY_INFO
if frequency info is not available.public Collection<Token> getTokens()
public void setTokens(Collection<Token> tokens)
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.