public void BindDirectObjectTest() { var target = new BaseVerb("slay"); IEntity directObject = new PersonalPronoun("them"); target.BindDirectObject(directObject); Check.That(target.DirectObjects).Contains(directObject); }
public void PronounConstructorTest() { var text = "him"; var target = new PersonalPronoun(text); Assert.True(target.Text == text, "Text property value correctly initialized via parameter"); //Assert.IsTrue(from.BoundEntity == null,"Bound Entity property was initialized to NULL"); }
public void BindReferencerTest() { var target = new CommonSingularNoun("dog"); var pronoun = new PersonalPronoun("it"); target.BindReferencer(pronoun); Check.That(target.Referencers).Contains(pronoun).Only(); Check.That(target.Referencers.All(r => r.RefersTo == target || r.RefersTo.Contains(target))).IsTrue(); }
public void IndirectReferencesTest() { var text = "he"; var target = new PersonalPronoun(text); Pronoun referencer = new PersonalPronoun("himslef"); target.BindReferencer(referencer); Check.That(target.Referencers).Contains(referencer); }
public void BindPronounTest() { var target = new NounPhrase(new ProperPluralNoun("Americans"), new Conjunction("and"), new ProperPluralNoun("Canadians")); Pronoun pro = new PersonalPronoun("they"); target.BindReferencer(pro); Check.That(target.Referencers).Contains(pro); Check.That(pro.RefersTo).Contains(target); }
public void BindPronounTest() { var text = "him"; var target = new PersonalPronoun(text); Pronoun pro = new PersonalPronoun("them"); target.BindReferencer(pro); Check.That(target.Referencers).Contains(pro); }
public void BindObjectTest() { var text = "with"; var target = new Preposition(text); ILexical prepositionalObject = new PersonalPronoun("them"); target.BindObject(prepositionalObject); Check.That(prepositionalObject).IsEqualTo(target.BoundObject); }
public void BindPronounTest() { var target = new CommonSingularNoun("dog"); Pronoun pronoun = new PersonalPronoun("it"); target.BindReferencer(pronoun); Check.That(target.Referencers).Contains(pronoun).Only(); Check.That(pronoun.RefersTo).Contains(target); }
public void PersonalPronounConstructorTest() { var text = "her"; var target = new PersonalPronoun(text); Check.That(target.Text).IsEqualTo(text); Check.That(target.IsFemale()).IsTrue(); Check.That(target.IsThirdPerson()).IsTrue(); Check.That(target.EntityKind).IsEqualTo(EntityKind.PersonFemale); }
public void BindSubjectTest() { var text = "gave"; Verb target = new BaseVerb(text); IEntity subject = new PersonalPronoun("he"); target.BindSubject(subject); Check.That(target.Subjects).Contains(subject).And.HasSize(1); }
public void BindIndirectObjectTest() { var text = "gave"; Verb target = new PastTenseVerb(text); IEntity indirectObject = new PersonalPronoun("him"); target.BindIndirectObject(indirectObject); Check.That(target.IndirectObjects).Contains(indirectObject).And.HasSize(1); }
public void IndirectReferencesTest() { var target = new NounPhrase(new ProperPluralNoun("Americans"), new Conjunction("and"), new ProperPluralNoun("Canadians")); Check.That(target.Referencers).IsEmpty(); Pronoun pro = new PersonalPronoun("they"); target.BindReferencer(pro); Check.That(target.Referencers.Contains(pro) && pro.RefersTo.Any(e => e == target)).IsTrue(); }
public void BoundSubjectTest() { var target = CreateVerbPhrase(); IEntity expected = new PersonalPronoun("he"); IEntity actual; target.BindSubject(expected); actual = target.Subjects.First(); Check.That(actual).IsEqualTo(expected); }
static string FirstPersonIndicativeStem(string infinitive) { // handy for the formation of the Subjuntive Present var pronoun = new PersonalPronoun("eu", Person.firstPersonSingular); string stem = conjugateVerb(infinitive, pronoun, Conjugation.Present); stem = stem.Substring(0, stem.Length - 1); return(stem); }
static string ThirdPersonPluralPreteriteModel(string infinitive) { // handy for the formation of the Subjunctives Imperfect and Future var pronoun = new PersonalPronoun("eles", Person.thirdPersonPlural); string stem = conjugateVerb(infinitive, pronoun, Conjugation.Preterite); stem = stem.Substring(0, stem.Length - 2); return(stem); }
public void EntityKindTest() { var text = "they"; var target = new PersonalPronoun(text); EntityKind actual; actual = target.EntityKind; Check.That(EntityKind.Undefined).IsEqualTo(actual); target.BindAsReferringTo(new NounPhrase(new[] { new CommonPluralNoun("apples") })); Check.That(EntityKind.ThingMultiple).IsEqualTo(target.EntityKind); }
public void SubjectOfTest() { var text = "him"; var target = new PersonalPronoun(text); IVerbal expected = new PastTenseVerb("frightened"); target.BindAsSubjectOf(expected); var actual = target.SubjectOf; Check.That(actual).IsEqualTo(expected); }
public void DirectObjectOfTest() { var text = "him"; var target = new PersonalPronoun(text); IVerbal expected = new PastTenseVerb("frightened"); target.BindAsDirectObjectOf(expected); var actual = target.DirectObjectOf; Check.That(actual.Match((IVerbal x) => x.Text)).IsEqualTo(expected.Text); }
public void IndirectObjectOfTest() { var text = "him"; var target = new PersonalPronoun(text); var verbal = new PastTenseVerb("frightened"); target.BindAsIndirectObjectOf(verbal); var actual = target.IndirectObjectOf; Check.That(actual).IsEqualTo(verbal); }
public void BoundEntityTest() { var text = "him"; var target = new PersonalPronoun(text); IEntity expected = new ProperSingularNoun("Aluan"); IAggregateEntity actual; target.BindAsReferringTo(expected); actual = target.RefersTo; Check.That(actual).Contains(expected); }
public void EqualsTest() { var text = "her"; var target = new PersonalPronoun(text); var obj = target as object; var expected = true; bool actual; actual = target.Equals(obj); Check.That(actual).IsEqualTo(expected); }
public void IndirectObjectsTest() { var target = CreateVerbPhrase(); IEnumerable <IEntity> actual; actual = target.IndirectObjects; Check.That(target.IndirectObjects).IsEmpty(); IEntity indirectObject = new PersonalPronoun("them"); target.BindIndirectObject(indirectObject); Check.That(target.IndirectObjects).Contains(indirectObject); }
public void RefereesTest() { var target = new CommonSingularNoun("dog"); IEnumerable <IReferencer> actual; actual = target.Referencers; Check.That(actual).IsEmpty(); Pronoun pro = new PersonalPronoun("it"); target.BindReferencer(pro); Check.That(target.Referencers).Contains(pro).Only(); Check.That(target.Referencers.All(r => r.RefersTo == target || r.RefersTo.Contains(target))).IsTrue(); }
public void AdjectivalModifierTest() { var target = new VerbPhrase(new PastTenseVerb("grew")); IEntity subject = new PersonalPronoun("he"); target.BindSubject(subject); IDescriptor expected = new Adjective("tall"); IDescriptor actual; target.PostpositiveDescriptor = expected; actual = target.PostpositiveDescriptor; Check.That(actual).IsEqualTo(expected); Check.That(subject.Descriptors).Contains(expected); }
static string conjugateVerb(string infinitive, PersonalPronoun pronoun, Conjugation conjugation) { string conjugatedVerb = null; if (isIrregular(infinitive, conjugation)) { conjugatedVerb = conjugateIrregularVerb(infinitive, pronoun, conjugation); } else { conjugatedVerb = conjugateRegularVerb(infinitive, pronoun, conjugation); } return(conjugatedVerb); }
static string conjugateIrregularVerb(string infinitive, PersonalPronoun pronoun, Conjugation conjugation) { string conjugatedVerb = null; Tense tense = Tenses.Find(o => o.conjugation == conjugation); List <IrregularVerb> irregularVerbs = tense.irregularVerbs; // not guaranteed to find IrregularVerb v = irregularVerbs.Find(o => o.m_infinitive == infinitive); if (v != null) { // guaranteed to find IrregularConjugation c = v.m_conjugations.Find(o => o.m_person == pronoun.person); conjugatedVerb = c.m_conjugatedVerb; } return(conjugatedVerb); }
public void BindPronounTest() { IEntity[] members = { new NounPhrase(new ProperPluralNoun("Americans")), new NounPhrase(new ProperPluralNoun("Canadians")) }; var target = new AggregateEntity(members); var them = new PersonalPronoun("them"); target.BindReferencer(them); Check.That(target.Referencers).Contains(them); Check.That(them.RefersTo.Contains(target) || them.RefersTo == target || them.RefersTo.SetEqual(target)).IsTrue(); foreach (var member in members) { Assert.True(them.RefersTo.Contains(member) || them.RefersTo == member); } }
public static void GetEmAll() { // For console output, set the code page to 1252 // c:\> chcp 1252 Conjugation[] conjugations = (Conjugation[])Enum.GetValues(typeof(Conjugation)); Person[] persons = (Person[])Enum.GetValues(typeof(Person)); foreach (var infinitive in infinitives) { System.Console.WriteLine(infinitive); foreach (var conjugation in conjugations) { System.Console.WriteLine(" {0}", conjugation); foreach (var person in persons) { PersonalPronoun pronoun = new PersonalPronoun("", person); // hope for the best! System.Console.WriteLine(" {0}", conjugateVerb(infinitive, pronoun, conjugation)); } } } }
static string conjugateRegularVerb(string infinitive, PersonalPronoun pronoun, Conjugation conjugation) { string conjugatedVerb; string newStem; string conjugatedEnding = null; // set up defaults string model = infinitive; string stem = model.Substring(0, model.Length - 2); // may get overwritten switch (conjugation) { case Conjugation.SubjunctivePresent: // the "tenho" case // keep the model, get the stem stem = FirstPersonIndicativeStem(infinitive); break; case Conjugation.SubjunctiveFuture: case Conjugation.SubjunctiveImperfect: // the "comeram" case again // suggest a whole new model and create a stem for it model = ThirdPersonPluralPreteriteModel(infinitive); stem = model.Substring(0, model.Length - 2); break; } char ending = model[model.Length - 2]; Tense t = Tenses.Find(o => o.conjugation == conjugation); Endings e = t.endings.Find(o => o.letter == ending); string[] endings = e.endings; switch (pronoun.person) { case Person.firstPersonSingular: conjugatedEnding = endings[0]; break; case Person.thirdPersonSingular: conjugatedEnding = endings[1]; break; case Person.firstPersonPlural: conjugatedEnding = endings[2]; break; case Person.thirdPersonPlural: conjugatedEnding = endings[3]; break; } switch (conjugation) { case Conjugation.SubjunctivePresent: if (!isIrregular(infinitive, Conjugation.Present)) { stem = orthoChanging2(infinitive, conjugatedEnding); } break; case Conjugation.SubjunctiveFuture: case Conjugation.SubjunctiveImperfect: if (!isIrregular(infinitive, Conjugation.Preterite)) { stem = orthoChanging2(infinitive, conjugatedEnding); } break; default: stem = orthoChanging2(infinitive, conjugatedEnding); break; } conjugatedVerb = stem + conjugatedEnding; return(conjugatedVerb); }
internal virtual ISimpleGendered CreateGendered() { ISimpleGendered target = new PersonalPronoun("he"); return(target); }