コード例 #1
0
        public virtual void stringElementAsHeadTest()
        {
            NPPhraseSpec np = phraseFactory.createNounPhrase();

            np.setHead(phraseFactory.createStringElement("dogs and cats"));
            np.setSpecifier(phraseFactory.createWord("the",
                                                     new LexicalCategory(LexicalCategory.LexicalCategoryEnum.DETERMINER)));
            Assert.AreEqual("the dogs and cats", realiser.realise(np).Realisation);
        }
コード例 #2
0
        public virtual void frontNPStringElementTest()
        {
            SPhraseSpec  senSpec = phraseFactory.createClause();
            NPPhraseSpec np      = phraseFactory.createNounPhrase();

            np.setHead("cat");
            np.setDeterminer("the");
            senSpec.addComplement(np);
            senSpec.addComplement(phraseFactory.createStringElement("loves a dog"));
            DocumentElement completeSen = phraseFactory.createSentence();

            completeSen.addComponent(senSpec);
            Assert.AreEqual("The cat loves a dog.", realiser.realise(completeSen).Realisation);
        }
コード例 #3
0
        public virtual void mulitpleStringElementsTest()
        {
            SPhraseSpec senSpec = phraseFactory.createClause();

            senSpec.addComplement(phraseFactory.createStringElement("the world loves"));
            NPPhraseSpec np = phraseFactory.createNounPhrase();

            np.setHead("ABBA");
            senSpec.addComplement(np);
            senSpec.addComplement(phraseFactory.createStringElement("but not a sore loser"));
            DocumentElement completeSen = phraseFactory.createSentence();

            completeSen.addComponent(senSpec);
            Assert.AreEqual("The world loves ABBA but not a sore loser.", realiser.realise(completeSen).Realisation);
        }
コード例 #4
0
        public virtual void mulitpleNPElementsTest()
        {
            SPhraseSpec  senSpec   = phraseFactory.createClause();
            NPPhraseSpec frontNoun = phraseFactory.createNounPhrase();

            frontNoun.setHead("john");
            senSpec.addComplement(frontNoun);
            senSpec.addComplement(phraseFactory.createStringElement("is a trier"));
            NPPhraseSpec backNoun = phraseFactory.createNounPhrase();

            backNoun.setDeterminer("for");
            backNoun.setNoun("cheese");
            senSpec.addComplement(backNoun);
            DocumentElement completeSen = phraseFactory.createSentence();

            completeSen.addComponent(senSpec);
            Assert.AreEqual("John is a trier for cheese.", realiser.realise(completeSen).Realisation);
        }