Esempio n. 1
0
        public virtual void xmlLexiconImmutabilityTest()
        {
            NLGFactory factory  = new NLGFactory(lexicon);
            Realiser   realiser = new Realiser(lexicon);

            // "wall" is singular.
            NPPhraseSpec wall = factory.createNounPhrase("the", "wall");

            Assert.AreEqual(NumberAgreement.SINGULAR, wall.getFeature(Feature.NUMBER));

            // Realise a sentence with plural form of "wall"
            wall.Plural = true;
            SPhraseSpec sentence = factory.createClause("motion", "observe");

            sentence.setFeature(Feature.TENSE, Tense.PAST);
            PPPhraseSpec pp = factory.createPrepositionPhrase("in", wall);

            sentence.addPostModifier(pp);
            realiser.realiseSentence(sentence);

            // Create a new 'the wall' NP and check to make sure that the syntax processor has
            // not propagated plurality to the canonical XMLLexicon WordElement object.
            wall = factory.createNounPhrase("the", "wall");
            Assert.AreEqual(NumberAgreement.SINGULAR, wall.getFeature(Feature.NUMBER));
        }