Class TrieLexicon

    • Constructor Detail

      • TrieLexicon

        public TrieLexicon​(String name,
                           boolean caseSensitive)
        Instantiates a new TrieLexicon.
        Parameters:
        name - the name
        caseSensitive - True - if case matters, False case does not matter
    • Method Detail

      • add

        public void add​(@NonNull
                        @NonNull LexiconEntry lexiconEntry)
        Description copied from class: Lexicon
        Adds an entry to the lexicon
        Specified by:
        add in class Lexicon
        Parameters:
        lexiconEntry - the lexicon entry to add
      • contains

        public boolean contains​(String string)
        Description copied from interface: WordList
        Is the String contained in the WordList
        Parameters:
        string - the string to lookup
        Returns:
        True if the string is in the WordList, False otherwise
      • get

        public Set<LexiconEntry> get​(String word)
        Description copied from class: Lexicon
        Returns the LexiconEntry associated with a given word in the Lexicon or an empty set if there are none.
        Specified by:
        get in class Lexicon
        Parameters:
        word - the word in the lexicon whose entries we want
        Returns:
        the LexiconEntry associated with a given word in the Lexicon or an empty set if there are none.
      • getMaxLemmaLength

        public int getMaxLemmaLength()
        Specified by:
        getMaxLemmaLength in class Lexicon
        Returns:
        the max lemma length
      • getMaxTokenLength

        public int getMaxTokenLength()
        Specified by:
        getMaxTokenLength in class Lexicon
        Returns:
        the max token length
      • getName

        @NonNull
        public @NonNull String getName()
        Specified by:
        getName in class Lexicon
        Returns:
        the name of the lexicon
      • isCaseSensitive

        public boolean isCaseSensitive()
        Description copied from class: Lexicon
        Is the Lexicon case sensitive or not
        Specified by:
        isCaseSensitive in class Lexicon
        Returns:
        True if the lexicon is case sensitive, False if not
      • isPrefixMatch

        public boolean isPrefixMatch​(HString hString)
        Description copied from interface: PrefixSearchable
        Check if a prefix matches the given HString
        Parameters:
        hString - the HString to check for a prefix match
        Returns:
        True if a prefix matches, False otherwise
      • isPrefixMatch

        public boolean isPrefixMatch​(String string)
        Description copied from interface: PrefixSearchable
        Check if a prefix matches the given String
        Parameters:
        string - the String to check for a prefix match
        Returns:
        True if a prefix matches, False otherwise
      • isProbabilistic

        public boolean isProbabilistic()
        Description copied from class: Lexicon
        Is the Lexicon case sensitive or not
        Specified by:
        isProbabilistic in class Lexicon
        Returns:
        True if the lexicon is case sensitive, False if not
      • match

        public List<LexiconEntry> match​(String hString)
        Description copied from class: Lexicon
        Returns the LexiconEntry associated with a given word in the Lexicon or an empty set if there are none.
        Specified by:
        match in class Lexicon
        Parameters:
        hString - the word in the lexicon whose entries we want
        Returns:
        the LexiconEntry associated with a given word in the Lexicon or an empty set if there are none.
      • prefixes

        public Set<String> prefixes​(String string)
        Description copied from interface: PrefixSearchable
        Gets the prefixes that match the given string
        Parameters:
        string - the string
        Returns:
        the set of matching prefixes
      • size

        public int size()
        Description copied from class: Lexicon
        The number of lexical items in the lexicon
        Specified by:
        size in interface WordList
        Specified by:
        size in class Lexicon
        Returns:
        the number of lexical items in the lexicon
      • suggest

        public Map<String,​Integer> suggest​(String element)
        Suggest map.
        Parameters:
        element - the element
        Returns:
        the map
      • suggest

        public Map<String,​Integer> suggest​(String element,
                                                 int maxCost)
        Suggest map.
        Parameters:
        element - the element
        maxCost - the max cost
        Returns:
        the map
      • suggest

        public Map<String,​Integer> suggest​(String element,
                                                 int maxCost,
                                                 int substitutionCost)
        Suggest map.
        Parameters:
        element - the element
        maxCost - the max cost
        substitutionCost - the substitution cost
        Returns:
        the map