/// <summary> /// Used in SubjectNounList to ensure all NPs are in base form (singular but no determiner) /// </summary> public static bool ForceBaseForm(NP np) { np.ForceCommonNoun = true; if (np.Number == Number.Plural) { return(false); } np.Number = Number.Singular; return(true); }
private void InitializeConstituents() { Subject = new NP(this) { Name = "Subject" }; Object = new NP(this) { Name = "Object" }; Verb = new VerbSegment(this) { Name = "Verb" }; Verb2 = new VerbSegment(this) { Name = "Verb2" }; SubjectNounList = new ReferringExpressionList <NP, Noun>(this, () => new NP(this) { ElementOfList = true }) { SanityCheck = SentencePattern.ForceBaseForm, Name = "Subjects" }; PredicateAPList = new ReferringExpressionList <AP, Adjective>(this, () => new AP(this)) { Name = "Adjectives" }; PredicateAP = new AP(this) { Name = "Adjective" }; ListName = new Segment(this) { Name = "ListName" }; ButtonName = new Segment(this) { Name = "ButtonName" }; Text = new Segment(this) { Name = "AnyText", AllowListConjunctions = true }; Quantifier = new QuantifyingDeterminer(this) { Name = "one/many/other" }; OptionalAll = new SimpleClosedClassSegment(this, "all", "any", "every") { Name = "[all]", Optional = true }; OptionalAlways = new SimpleClosedClassSegment(this, "always") { Name = "[always]", Optional = true }; OptionalOther = new SimpleClosedClassSegment(this, "other", "another") { Name = "[other]", Optional = true }; ExistNotExist = new SimpleClosedClassSegment(this, "exist", new[] { "not", "exist" }, new[] { "never", "exist" }) { Name = "exist/not exist" }; RareCommon = new ClosedClassSegmentWithValue <float>(this, new KeyValuePair <object, float>(new[] { "very", "rare" }, 0.05f), new KeyValuePair <object, float>("rare", 0.15f), new KeyValuePair <object, float>("common", 0.85f), new KeyValuePair <object, float>(new[] { "very", "common" }, 0.95f)) { Name = "rare/common" }; CanMust = new SimpleClosedClassSegment(this, "can", "must") { Name = "can/must" }; CanNot = new SimpleClosedClassSegment(this, "cannot", "never", new[] { "can", "not" }, new[] { "can", "'", "t" }, new[] { "do", "not" }, new[] { "do", "'", "t" }) { Name = "cannot" }; Reflexive = new SimpleClosedClassSegment(this, "itself", "himself", "herself", "themselves") { Name = "itself" }; PossessivePronoun = new SimpleClosedClassSegment(this, "its", "their", "his", "her") { Name = "its" }; Always = new SimpleClosedClassSegment(this, "must", "always") { Name = "always" }; EachOther = new SimpleClosedClassSegment(this, new[] { "each", "other" }, new[] { "one", "another" }) { Name = "each other" }; }