Class SuggestionsChanges


  • public class SuggestionsChanges
    extends Object
    Helper class for SuggestionChangesTest, tracks experiment configuration and results Rules should use getInstance() != null -> getInstance().getCurrentExperiment() in constructors to fetch relevant parameters Use isRunningExperiment if no parameters are needed
    • Method Detail

      • getInstance

        @Nullable
        public static @Nullable SuggestionsChanges getInstance()
        null if nothing is configured, i.e. in most normal use cases
      • getConfig

        public org.languagetool.rules.spelling.suggestions.SuggestionChangesTestConfig getConfig()
      • setCurrentExperiment

        public void setCurrentExperiment​(@Nullable
                                         @Nullable SuggestionChangesExperiment experiment)
        For testing changes to suggestion ordering using a data corpus; iterate over experiments (including grid search for parameters) original behavior (for A/B testing) can be modeled by an experiment without parameters and an arbitrary name
      • isRunningExperiment

        public static boolean isRunningExperiment​(String name)
      • trackExperimentResult

        public void trackExperimentResult​(org.apache.commons.lang3.tuple.Pair<SuggestionChangesExperiment,​org.languagetool.rules.spelling.suggestions.SuggestionChangesDataset> source,
                                          int position,
                                          int resultTextSize,
                                          long resultComputationTime)