Пример #1
0
        /**
         * Adds <em>to</em> to the end of interrogatives concerning indirect
         * objects. For example, <em>who did John give the flower <b>to</b></em>.
         *
         * @param phrase
         *            the <code>PhraseElement</code> representing this clause.
         * @param parent
         *            the parent <code>SyntaxProcessor</code> that will do the
         *            realisation of the complementiser.
         * @param realisedElement
         *            the current realisation of the clause.
         * @param phraseFactory
         *            the phrase factory to be used.
         */

        private static void addEndingTo(PhraseElement phrase,
                                        SyntaxProcessor parent,
                                        ListElement realisedElement,
                                        NLGFactory phraseFactory)
        {
            if (InterrogativeType.WHO_INDIRECT_OBJECT.Equals(phrase.getFeature(Feature.INTERROGATIVE_TYPE.ToString())))
            {
                var word = phraseFactory.createWord("to", new LexicalCategory_PREPOSITION());
                realisedElement.addComponent(parent.realise(word));
            }
        }
Пример #2
0
        /**
         * Sets the determiner for the phrase. This only has real meaning on noun
         * phrases and is added here for convenience. Determiners are some times
         * referred to as specifiers.
         *
         * @param newDeterminer
         *            the new determiner for the phrase.
         * @deprecated Use {@link NPPhraseSpec#setSpecifier(object)} directly
         */

        public virtual void setDeterminer(object newDeterminer)
        {
            var factory           = new NLGFactory();
            var determinerElement = factory.createWord(newDeterminer, new LexicalCategory_DETERMINER());

            if (determinerElement != null)
            {
                determinerElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(),
                                             DiscourseFunction.SPECIFIER);
                setFeature(InternalFeature.SPECIFIER.ToString(), determinerElement);
                determinerElement.setParent(this);
            }
        }
Пример #3
0
        /**
         * create an empty clause
         */

        public SPhraseSpec(NLGFactory phraseFactory) : base(new PhraseCategory_CLAUSE())
        {
            base.setFactory(phraseFactory);
            // create VP
            setVerbPhrase(phraseFactory.createVerbPhrase());

            // set default values
            setFeature(Feature.ELIDED.ToString(), false);
            setFeature(InternalFeature.CLAUSE_STATUS.ToString(), ClauseStatus.MATRIX);
            setFeature(Feature.SUPRESSED_COMPLEMENTISER.ToString(), false);
            setFeature(LexicalFeature.EXPLETIVE_SUBJECT, false);
            setFeature(Feature.COMPLEMENTISER.ToString(), phraseFactory.createWord(
                           "that", new LexicalCategory_COMPLEMENTISER()));
        }
Пример #4
0
        /**
         * Realises the key word of the interrogative. For example, <em>who</em>,
         * <em>what</em>
         *
         * @param keyWord
         *            the key word of the interrogative.
         * @param cat
         *            the category (usually pronoun, but not in the case of
         *            "how many")
         * @param parent
         *            the parent <code>SyntaxProcessor</code> that will do the
         *            realisation of the complementiser.
         * @param realisedElement
         *            the current realisation of the clause.
         * @param phraseFactory
         *            the phrase factory to be used.
         */

        private static void realiseInterrogativeKeyWord(string keyWord,
                                                        ILexicalCategory cat,
                                                        SyntaxProcessor parent,
                                                        ListElement realisedElement,
                                                        NLGFactory phraseFactory)
        {
            if (keyWord != null)
            {
                var question       = phraseFactory.createWord(keyWord, cat);
                var currentElement = parent.realise(question);

                if (currentElement != null)
                {
                    realisedElement.addComponent(currentElement);
                }
            }
        }