public void I_have_been_reading()
        {
            List <Morpheme> morphemes = new List <Morpheme>()
            {
                new Morpheme(myAttributesModel, "i", EnglishAttributes.O.Lexeme.Pronoun),
                new Morpheme(myAttributesModel, "have", EnglishAttributes.I.Lexeme.Verb),
                new Morpheme(myAttributesModel, "been", EnglishAttributes.I.Lexeme.Verb.Sememe.Tense.Past | EnglishAttributes.I.Lexeme.Verb.Form.PastParticiple),
                new Morpheme(myAttributesModel, "read", EnglishAttributes.I.Lexeme.Verb.Valency.Bivalent),
                new Morpheme(myAttributesModel, "ing", EnglishAttributes.I.NonLexeme.Suffix.Sememe.Aspect.Continuous),
            };

            List <Pattern> patterns = new List <Pattern>()
            {
                EnglishPattern.Morpheme(EnglishAttributes.O.Lexeme),
                EnglishPattern.Morpheme(EnglishAttributes.I.Lexeme),

                EnglishPattern.O1_I.SetLeftFirst(),

                EnglishPattern.Morpheme(EnglishAttributes.I.NonLexeme.Suffix, "I+"),

                EnglishPattern.PairTransference("I>PresentPerfect", "",
                                                EnglishAttributes.I.Lexeme.Verb.Sememe.Tense.Present | EnglishAttributes.I.Lexeme.Verb.Sememe.Aspect.Perfect,
                                                EnglishMorphemeRule.Is(MorphRules.Is("have"), EnglishAttributes.I.Lexeme.Verb).SetSubstitution(SubstitutionRules.Nothing),
                                                EnglishMorphemeRule.Is(MorphRules.Something, EnglishAttributes.I.Lexeme.Verb.Form.PastParticiple))
                .SetLeftFirst(),

                EnglishPattern.PairTransference("been-I_ing", "",
                                                EnglishAttributes.I.Lexeme.Verb.Form.PastParticiple,
                                                EnglishMorphemeRule.Is("been", EnglishAttributes.I.Lexeme.Verb.Sememe.Tense.Past | EnglishAttributes.I.Lexeme.Verb.Form.PastParticiple).SetSubstitution(SubstitutionRules.Nothing),
                                                EnglishMorphemeRule.Is(MorphRules.Something, EnglishAttributes.I.Lexeme.Verb.Sememe.Aspect.Continuous))
                .SetLeftFirst(),

                EnglishPattern.PairTransference("I>I_ing", "",
                                                EnglishAttributes.I.Lexeme.Verb.Sememe.Aspect.Continuous,
                                                EnglishAttributes.I.NonLexeme.Suffix.Sememe.Aspect.Continuous, 0,
                                                EnglishAttributes.I.Lexeme.Verb, EnglishAttributes.I.Lexeme.Verb.Modal),
            };

            ConstructiveDictionary dictionary = new ConstructiveDictionary(myAttributesModel, morphemes, patterns);

            AdTreeCreator  creator = new AdTreeCreator(dictionary);
            List <IAdTree> results = creator.Create("i", "have", "been", "reading");

            Assert.AreEqual(1, results.Count);

            Assert.AreEqual("i", results[0].Left.Morpheme.Morph);
            Assert.AreEqual("have", results[0].Right.Left.Morpheme.Morph);
            Assert.AreEqual("been", results[0].Right.Right.Left.Morpheme.Morph);
            Assert.AreEqual("ing", results[0].Right.Right.Right.Left.Morpheme.Morph);
            Assert.AreEqual("read", results[0].Right.Right.Right.Right.Morpheme.Morph);
        }
Beispiel #2
0
 public static MorphemeRule Is(string morph, BigInteger attributes) => Is(MorphRules.Is(morph), attributes, 0);