Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created September 25, 2019 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IntegerMan/e7905575f8bf52b536074bc9cb8c2565 to your computer and use it in GitHub Desktop.
Save IntegerMan/e7905575f8bf52b536074bc9cb8c2565 to your computer and use it in GitHub Desktop.
private extractTokensFromInput(sentence: string): CommandToken[] {
const lexer = LexiconService.instance;
sentence = lexer.replaceWords(sentence);
// Break down the input into command tokens
const tokens: CommandToken[] = this.nlp.getTokensForSentence(sentence);
// Some tokens are shortcuts for common actions. These should be replaced as if the user had spoken the full word.
lexer.replaceTokens(tokens, this.nlp);
return tokens;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment