Class LexiconEntry

    • Method Detail

      • calculateTokenLength

        public static int calculateTokenLength​(@NonNull
                                               @NonNull String phrase,
                                               @NonNull
                                               @NonNull Language language)
        Helper method for calculating the length in tokens of a phrase for a given language.
        Parameters:
        phrase - the phrase
        language - the language
        Returns:
        the number of tokens in the phrase.
      • empty

        public static LexiconEntry empty()
        Empty lexicon entry.
        Returns:
        the lexicon entry
      • of

        public static LexiconEntry of​(@NonNull
                                      @NonNull String lemma,
                                      int tokenLength)
        Constructs a LexiconEntry for the given lemma which has the given token length.
        Parameters:
        lemma - the lemma
        tokenLength - the token length
        Returns:
        the lexicon entry
      • of

        public static LexiconEntry of​(@NonNull
                                      @NonNull String lemma,
                                      double probability,
                                      String tag,
                                      int tokenLength)
        Constructs a LexiconEntry for the given lemma which has the given probability, tag, and token length.
        Parameters:
        lemma - the lemma
        probability - the probability
        tag - the tag
        tokenLength - the token length
        Returns:
        the lexicon entry
      • of

        public static LexiconEntry of​(@NonNull
                                      @NonNull String lemma,
                                      double probability,
                                      String tag,
                                      LyreExpression constraint,
                                      int tokenLength)
        Constructs a LexiconEntry for the given lemma which has the given probability, tag, constraint, and token length.
        Parameters:
        lemma - the lemma
        probability - the probability
        tag - the tag
        constraint - the constraint
        tokenLength - the token length
        Returns:
        the lexicon entry
      • of

        public static LexiconEntry of​(@NonNull
                                      @NonNull String lemma,
                                      double probability,
                                      int tokenLength)
        Constructs a LexiconEntry for the given lemma which has the given probability and token length.
        Parameters:
        lemma - the lemma
        probability - the probability
        tokenLength - the token length
        Returns:
        the lexicon entry
      • of

        public static LexiconEntry of​(@NonNull
                                      @NonNull String lemma,
                                      String tag,
                                      int tokenLength)
        Constructs a LexiconEntry for the given lemma which has the given tag and token length.
        Parameters:
        lemma - the lemma
        tag - the tag
        tokenLength - the token length
        Returns:
        the lexicon entry