Class NgramLanguageModel.StaticMethods

  • Enclosing interface:
    NgramLanguageModel<W>

    public static class NgramLanguageModel.StaticMethods
    extends java.lang.Object
    • Constructor Detail

      • StaticMethods

        public StaticMethods()
    • Method Detail

      • sample

        public static <W> java.util.List<W> sample​(java.util.Random random,
                                                   NgramLanguageModel<W> lm)
        Samples from this language model. This is not meant to be particularly efficient
        Parameters:
        random -
        Returns:
      • sample

        public static <W> java.util.List<W> sample​(java.util.Random random,
                                                   NgramLanguageModel<W> lm,
                                                   double sampleTemperature)
      • getDistributionOverNextWords

        public static <W> Counter<W> getDistributionOverNextWords​(NgramLanguageModel<W> lm,
                                                                  java.util.List<W> context)
        Builds a distribution over next possible words given the context. Context can be of any length, but only at most lm.getLmOrder() - 1 words are actually used.
        Type Parameters:
        W -
        Parameters:
        lm -
        context -
        Returns: