Class SuggestionsOrdererFeatureExtractor

  • All Implemented Interfaces:
    SuggestionsOrderer
    Direct Known Subclasses:
    XGBoostSuggestionsOrderer

    public class SuggestionsOrdererFeatureExtractor
    extends java.lang.Object
    implements SuggestionsOrderer
    Computes features that can be stored for training a model to rank suggestions, or when using the same model for prediction Used directly by SuggestionChangesTest for the former, and as a superclass for the latter
    • Field Detail

      • logger

        private static final org.slf4j.Logger logger
      • language

        protected final Language language
      • topN

        protected int topN
      • score

        protected java.lang.String score
      • mistakeProb

        protected double mistakeProb
    • Constructor Detail

      • SuggestionsOrdererFeatureExtractor

        public SuggestionsOrdererFeatureExtractor​(Language lang,
                                                  LanguageModel languageModel)
    • Method Detail

      • initParameters

        protected void initParameters()
      • computeFeatures

        public org.apache.commons.lang3.tuple.Pair<java.util.List<SuggestedReplacement>,​java.util.SortedMap<java.lang.String,​java.lang.Float>> computeFeatures​(java.util.List<java.lang.String> suggestions,
                                                                                                                                                                           java.lang.String word,
                                                                                                                                                                           AnalyzedSentence sentence,
                                                                                                                                                                           int startPos)
        compute features for training or prediction of a ranking model for suggestions
        Parameters:
        suggestions -
        word -
        sentence -
        startPos -
        Returns:
        correction candidates, features for the match in general, features specific to candidates