private Noun GetCommonNoun(string[] text) { var noun = (CommonNoun)Ontology.Noun(text); if (noun != null) { var singular = noun.SingularForm.SameAs(text); if (singular && Number == Parser.Number.Plural && !noun.SingularForm.SameAs(noun.PluralForm)) { throw new GrammaticalError($"The singular noun '{Text.Untokenize()}' was used without 'a' or 'an' before it", $"The singular noun '<i>{Text.Untokenize()}</i>' was used without 'a' or 'an' before it"); } if (!singular && Number == Parser.Number.Singular) { throw new GrammaticalError($"The plural noun '{Text.Untokenize()}' was used with 'a' or 'an'", $"The plural noun '<i>{Text.Untokenize()}</i>' was used with 'a' or 'an' before it"); } return(noun); } noun = new CommonNoun(Ontology, text); if (!Number.HasValue) { // Don't know syntactically if it's supposed to be singular or plural, so guess. Number = Inflection.NounAppearsPlural(text) ? Parser.Number.Plural : Parser.Number.Singular; } if (Number == Parser.Number.Singular) { noun.SingularForm = text; } else { // Note: this guarantees there is a singular form. noun.PluralForm = text; } Driver.Driver.AppendResponseLine($"Learned the new common noun <b><i>{noun.SingularForm.Untokenize()}</i></b>."); Parser.MaybeLoadDefinitions(noun); return(noun); }
private bool VerbGerundForm(VerbSegment s) { s.Conjugation = VerbConjugation.Gerund; return(Inflection.IsGerund(s.Text)); }