protected string ProcessNoun(string word, ParserStatesEnum nextState) { var noun = Nouns.GetNounForSynonym(word); if (!string.IsNullOrEmpty(noun)) { _parserStates = nextState; return(noun); } return(string.Empty); }
protected PropositionEnum ProcessPreposition(string word, ParserStatesEnum nextState) { var preposition = Prepositions.GetPreposition(word); if (preposition != PropositionEnum.NotRecognised) { _parserStates = nextState; return(preposition); } return(PropositionEnum.NotRecognised); }
private bool ProcessPreposition(string word) { var preposition = Prepositions.GetPreposition(word); if (preposition != PropositionEnum.NotRecognised) { _command.Preposition = preposition; _parserStates = ParserStatesEnum.Noun2; return(true); } return(false); }
private bool ProcessNoun1(string word) { var noun = Nouns.GetNounForSynonym(word); if (!string.IsNullOrEmpty(noun)) { _command.Noun = noun; _parserStates = ParserStatesEnum.Preposition; return(true); } return(false); }
private bool ProcessVerbs(string word) { var verb = Verbs.GetVerbForSynonym(word); _parserStates = ParserStatesEnum.Noun; if (verb != VerbCodes.NoCommand) { _command.Verb = verb; return(true); } return(false); }
protected VerbCodes ProcessVerbs(string word, ParserStatesEnum nextState) { var verb = Verbs.GetVerbForSynonym(word); if (verb != VerbCodes.NoCommand) { _parserStates = nextState; } if (verb != VerbCodes.NoCommand) { return(verb); } return(VerbCodes.NoCommand); }
private void MultiWordCommand(string[] commandList) { foreach (var word in commandList) { if (_parserStates == ParserStatesEnum.Verb) { if (ProcessVerbs(word)) { continue; } } if (_parserStates == ParserStatesEnum.Noun) { if (ProcessNoun1(word)) { continue; } } if (_parserStates == ParserStatesEnum.Preposition) { if (ProcessPreposition(word)) { continue; } } if (_parserStates == ParserStatesEnum.Noun2) { ProcessNoun2(word); } } _parserStates = ParserStatesEnum.Verb; }