Example #1
0
        public virtual void testExtraWhitespace()
        {
            NPPhraseSpec np1 = phraseFactory.createNounPhrase("a", "vessel");

            // empty coordinate as premod
            np1.setPreModifier(phraseFactory.createCoordinatedPhrase());
            Assert.AreEqual("a vessel", realiser.realise(np1).Realisation);


            // empty adjP as premod
            np1.setPreModifier(phraseFactory.createAdjectivePhrase());
            Assert.AreEqual("a vessel", realiser.realise(np1).Realisation);


            // empty string
            np1.setPreModifier("");
            Assert.AreEqual("a vessel", realiser.realise(np1).Realisation);
        }
Example #2
0
        public virtual void testAAnWithNumbers()
        {
            NPPhraseSpec num = phraseFactory.createNounPhrase("a", "change");
            string       realisation;

            // no an with "one"
            num.setPreModifier("one percent");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("a one percent change", realisation);

            // an with "eighty"
            num.setPreModifier("eighty percent");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("an eighty percent change", realisation);

            // an with 80
            num.setPreModifier("80%");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("an 80% change", realisation);

            // an with 80000
            num.setPreModifier("80000");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("an 80000 change", realisation);

            // an with 11,000
            num.setPreModifier("11,000");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("an 11,000 change", realisation);

            // an with 18
            num.setPreModifier("18%");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("an 18% change", realisation);

            // a with 180
            num.setPreModifier("180");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("a 180 change", realisation);

            // a with 1100
            num.setPreModifier("1100");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("a 1100 change", realisation);

            // a with 180,000
            num.setPreModifier("180,000");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("a 180,000 change", realisation);

            // an with 11000
            num.setPreModifier("11000");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("an 11000 change", realisation);

            // an with 18000
            num.setPreModifier("18000");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("an 18000 change", realisation);

            // an with 18.1
            num.setPreModifier("18.1%");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("an 18.1% change", realisation);

            // an with 11.1
            num.setPreModifier("11.1%");
            realisation = realiser.realise(num).Realisation;
            Assert.AreEqual("an 11.1% change", realisation);
        }