Пример #1
0
        public void HasSubjectPronounTest()
        {
            var phrase = new PronounPhrase(
                new PersonalPronoun("they"),
                new PersonalPronoun("themselves")
                );

            Assert.True(phrase.HasSubjectPronoun());
        }
Пример #2
0
        public void ToTheLeftOfTest()
        {
            var      target   = new ParticlePhrase(new Particle("off"), new Preposition("of"));
            ILexical expected = new PronounPhrase(new PersonalPronoun("they"));
            ILexical actual;

            target.ToTheLeftOf = expected;
            actual             = target.ToTheLeftOf;
            Check.That(actual).IsEqualTo(expected);
        }
Пример #3
0
        public void HasSubjectPronounTest3()
        {
            var phrase = new PronounPhrase(
                new PersonalPronoun("him"),
                new Conjunction("and"),
                new PersonalPronoun("her")
                );

            Assert.False(phrase.HasSubjectPronoun());
        }
Пример #4
0
        public void HasSubjectPronounTest2()
        {
            var phrase = new PronounPhrase(
                new PersonalPronoun("she"),
                new Conjunction("and"),
                new PersonalPronoun("it")
                );

            Assert.True(phrase.HasSubjectPronoun());
        }
Пример #5
0
        private static Gender DeterminePronounPhraseGender(PronounPhrase pronounPhrase)
        {
            if (pronounPhrase.Words.All(w => w is Determiner))
            {
                return(Gender.Undetermined);
            }
            var genders = pronounPhrase.Words.OfType <ISimpleGendered>().Select(w => w.Gender);

            return(pronounPhrase.Words.OfProperNoun().Any(n => !(n is ISimpleGendered))
                ? DetermineNounPhraseGender(pronounPhrase)
                : genders.Any()
                    ? genders.All(g => g.IsFemale()) ? Gender.Female
                    : genders.All(g => g.IsMale()) ? Gender.Male
                    : genders.All(g => g.IsNeutral()) ? Gender.Neutral : Gender.Undetermined
                    : Gender.Undetermined);
        }