Class DiskLexicon

    • Constructor Detail

      • DiskLexicon

        public DiskLexicon​(@NonNull
                           @NonNull KeyValueStoreConnection connection,
                           boolean isCaseSensitive)
        Instantiates a new DiskLexicon
        Parameters:
        connection - the KeyValueStoreConnection describing how to connect to the underlying storage.
        isCaseSensitive - True - the lexicon is case-sensitive, False case-insensitive (Note: if the lexicon already exists this value will be ignored.)
    • 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
      • addAll

        public void addAll​(@NonNull
                           @NonNull Iterable<LexiconEntry> lexiconEntries)
        Description copied from class: Lexicon
        Adds all lexicon entries in the given iterable to the lexicon
        Overrides:
        addAll in class Lexicon
        Parameters:
        lexiconEntries - the lexicon entries to add
      • contains

        public boolean contains​(String string)
        Description copied from interface: WordList
        Is the String contained in the WordList
        Specified by:
        contains in interface 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

        public 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​(@NonNull
                                     @NonNull HString hString)
        Description copied from interface: PrefixSearchable
        Check if a prefix matches the given HString
        Specified by:
        isPrefixMatch in interface PrefixSearchable
        Parameters:
        hString - the HString to check for a prefix match
        Returns:
        True if a prefix matches, False otherwise
      • isPrefixMatch

        public boolean isPrefixMatch​(String hString)
        Description copied from interface: PrefixSearchable
        Check if a prefix matches the given String
        Specified by:
        isPrefixMatch in interface PrefixSearchable
        Parameters:
        hString - 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
        Specified by:
        prefixes in interface PrefixSearchable
        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