Class XGBoostSuggestionsOrderer
- java.lang.Object
-
- org.languagetool.rules.spelling.suggestions.SuggestionsOrdererFeatureExtractor
-
- org.languagetool.rules.spelling.suggestions.XGBoostSuggestionsOrderer
-
- All Implemented Interfaces:
SuggestionsOrderer
,SuggestionsRanker
public class XGBoostSuggestionsOrderer extends SuggestionsOrdererFeatureExtractor implements SuggestionsRanker
-
-
Field Summary
-
Fields inherited from class org.languagetool.rules.spelling.suggestions.SuggestionsOrdererFeatureExtractor
language, languageModel, mistakeProb, score, topN
-
-
Constructor Summary
Constructors Constructor Description XGBoostSuggestionsOrderer(Language lang, LanguageModel languageModel)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
initParameters()
boolean
isMlAvailable()
List<SuggestedReplacement>
orderSuggestions(List<String> suggestions, String word, AnalyzedSentence sentence, int startPos)
static void
setAutoCorrectThresholdForLanguage(Language lang, float value)
For testing purposes onlyboolean
shouldAutoCorrect(List<SuggestedReplacement> rankedSuggestions)
Model output should have been calibrated using a precision-recall curve evaluation, so that a threshold for confidence values with sufficiently high precision for auto correction is known-
Methods inherited from class org.languagetool.rules.spelling.suggestions.SuggestionsOrdererFeatureExtractor
computeFeatures
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.languagetool.rules.spelling.suggestions.SuggestionsOrderer
orderSuggestionsUsingModel
-
-
-
-
Constructor Detail
-
XGBoostSuggestionsOrderer
public XGBoostSuggestionsOrderer(Language lang, LanguageModel languageModel)
-
-
Method Detail
-
setAutoCorrectThresholdForLanguage
public static void setAutoCorrectThresholdForLanguage(Language lang, float value)
For testing purposes only
-
initParameters
protected void initParameters()
- Overrides:
initParameters
in classSuggestionsOrdererFeatureExtractor
-
isMlAvailable
public boolean isMlAvailable()
- Specified by:
isMlAvailable
in interfaceSuggestionsOrderer
- Overrides:
isMlAvailable
in classSuggestionsOrdererFeatureExtractor
-
orderSuggestions
public List<SuggestedReplacement> orderSuggestions(List<String> suggestions, String word, AnalyzedSentence sentence, int startPos)
- Specified by:
orderSuggestions
in interfaceSuggestionsOrderer
- Overrides:
orderSuggestions
in classSuggestionsOrdererFeatureExtractor
-
shouldAutoCorrect
public boolean shouldAutoCorrect(List<SuggestedReplacement> rankedSuggestions)
Description copied from interface:SuggestionsRanker
Model output should have been calibrated using a precision-recall curve evaluation, so that a threshold for confidence values with sufficiently high precision for auto correction is known- Specified by:
shouldAutoCorrect
in interfaceSuggestionsRanker
- Parameters:
rankedSuggestions
- suggestions returned by orderSuggestions- Returns:
- if confidence is high enough for auto correction
-
-