Class SentenceLexer

  • Direct Known Subclasses:
    PathLexer

    public abstract class SentenceLexer
    extends java.lang.Object
    Class to convert a sentence to tokens This class is fully customizable by passing in your own tokenizer and evaluator functions.
    • Constructor Summary

      Constructors 
      Constructor Description
      SentenceLexer()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract GResultOf<java.util.List<Token>> evaluator​(java.lang.String word, java.lang.String sentence)
      Takes in an elements such as abc or def[3] then converts it into a Token.
      abstract java.lang.String getDeliminator()
      Return the deliminator.
      java.lang.String normalizeSentence​(java.lang.String sentence)
      Takes a sentence and normalize it so we can match tokens from all various systems.
      GResultOf<java.util.List<Token>> scan​(java.lang.String sentence)
      Scan a string a provide a list of tokens.
      protected abstract java.util.List<java.lang.String> tokenizer​(java.lang.String sentence)
      Takes in a string representation of a path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SentenceLexer

        public SentenceLexer()
    • Method Detail

      • getDeliminator

        public abstract java.lang.String getDeliminator()
        Return the deliminator.
        Returns:
        the deliminator
      • tokenizer

        protected abstract java.util.List<java.lang.String> tokenizer​(java.lang.String sentence)
        Takes in a string representation of a path. Ie abc.def or ABC_DEF then returns each element separated by the delimiter
        Parameters:
        sentence - the sentence to tokenize
        Returns:
        list of tokenized strings from sentance.
      • evaluator

        protected abstract GResultOf<java.util.List<Token>> evaluator​(java.lang.String word,
                                                                      java.lang.String sentence)
        Takes in an elements such as abc or def[3] then converts it into a Token.
        Parameters:
        word - The First string in the method params is the word in the string we are evaluating
        sentence - second string in the method params is the path the word is in.
        Returns:
        GResultOf list of tokens from a word.
      • normalizeSentence

        public java.lang.String normalizeSentence​(java.lang.String sentence)
        Takes a sentence and normalize it so we can match tokens from all various systems.
        Parameters:
        sentence - input sentence to normalize
        Returns:
        a normalized sentence.
      • scan

        public GResultOf<java.util.List<Token>> scan​(java.lang.String sentence)
        Scan a string a provide a list of tokens.
        Parameters:
        sentence - sentence to scan
        Returns:
        list of token