- java.lang.Object
-
- org.github.gestalt.config.lexer.SentenceLexer
-
- Direct Known Subclasses:
PathLexer
public abstract class SentenceLexer extends java.lang.ObjectClass 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.StringgetDeliminator()Return the deliminator.java.lang.StringnormalizeSentence(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.
-
-
-
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 evaluatingsentence- 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.
-
-