public NLPActionResult GrammarDumpWithSpellingMistake(define2 define, [AboditNLP.Attributes.Insensitive(caseInsensitive: true, editDistance: 1)] IAmbiguous <ITokenText> token) { if (token.Count() == 1) { st.Say($"I think you perhaps meant 'define {token.First().Text}'"); // But go ahead and show some more aggressive approximate matches anyway intent.DefineSuggestions(st, token.First().Text); } else { st.Say($"I think you perhaps meant 'define' and then one of {string.Join(", ", token.Select(x => x.Text))}"); } return(NLPActionResult.None); }
public void GrammarDump(IListener st, IAmbiguous <ITokenText> tokenAmbiguous) { if (tokenAmbiguous.Count() > 1) { st.Say(tokenAmbiguous.First().Text + " could mean one of several things:"); } int i = 0; foreach (var tokenGroup in tokenAmbiguous.GroupBy(t => t.Synset ?? SynSet.Empty)) { st.Say(++i + ". " + tokenGroup.Key.Name); if (tokenGroup.Key == SynSet.Empty) { foreach (var t in tokenGroup) { this.GrammarDump(st, t); } } else { this.GrammarDump(st, tokenGroup.First()); } } }