Class LanguageProfileBuilder


  • public class LanguageProfileBuilder
    extends Object
    Builder for LanguageProfile.

    This class does no internal synchronization.

    Author:
    Fabian Kessler
    • Constructor Detail

      • LanguageProfileBuilder

        public LanguageProfileBuilder​(@NotNull
                                      @NotNull LdLocale locale)
      • LanguageProfileBuilder

        @Deprecated
        public LanguageProfileBuilder​(@NotNull
                                      @NotNull String locale)
        Deprecated.
    • Method Detail

      • minimalFrequency

        public LanguageProfileBuilder minimalFrequency​(int minimalFrequency)
        Parameters:
        minimalFrequency - 1-n, the default is 1. n-grams that occurred less often in the text are removed. This really should be set to something higher. Try to play with the number until you get a profile file of satisfying size, that produces good language detection results.
      • addGram

        public LanguageProfileBuilder addGram​(String ngram,
                                              int frequency)
        If the builder already has this ngram, the given frequency is added to the current count.