Esempio n. 1
0
        /**
         * Realises the subjects of a passive clause.
         *
         * @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 addPassiveSubjects(PhraseElement phrase,
                                               SyntaxProcessor parent,
                                               ListElement realisedElement,
                                               NLGFactory phraseFactory)
        {
            INLGElement currentElement = null;

            if (phrase.getFeatureAsBoolean(Feature.PASSIVE.ToString()))
            {
                var allSubjects = phrase.getFeatureAsElementList(InternalFeature.SUBJECTS.ToString());

                if (allSubjects.size() > 0 || phrase.hasFeature(Feature.INTERROGATIVE_TYPE.ToString()))
                {
                    realisedElement.addComponent(parent.realise(phraseFactory.createPrepositionPhrase("by")));
                }

                foreach (var subject in allSubjects)
                {
                    subject.setFeature(Feature.PASSIVE.ToString(), true);
                    if (subject.isA(PhraseCategoryEnum.NOUN_PHRASE) || subject is CoordinatedPhraseElement)
                    {
                        currentElement = parent.realise(subject);
                        if (currentElement != null)
                        {
                            currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(), DiscourseFunction.SUBJECT);
                            realisedElement.addComponent(currentElement);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        /**
         * Realises the head noun of the noun phrase.
         *
         * @param phrase
         *            the <code>PhraseElement</code> representing this noun phrase.
         * @param parent
         *            the parent <code>SyntaxProcessor</code> that will do the
         *            realisation of the complementiser.
         * @param realisedElement
         *            the current realisation of the noun phrase.
         */

        private static void realiseHeadNoun(PhraseElement phrase,
                                            SyntaxProcessor parent, ListElement realisedElement)
        {
            INLGElement headElement = phrase.getHead();

            if (headElement != null)
            {
                headElement.setFeature(Feature.ELIDED.ToString(), phrase
                                       .getFeature(Feature.ELIDED.ToString()));
                headElement.setFeature(LexicalFeature.GENDER, phrase
                                       .getFeature(LexicalFeature.GENDER));
                headElement.setFeature(InternalFeature.ACRONYM.ToString(), phrase
                                       .getFeature(InternalFeature.ACRONYM.ToString()));
                headElement.setFeature(Feature.NUMBER.ToString(), phrase
                                       .getFeature(Feature.NUMBER.ToString()));
                headElement.setFeature(Feature.PERSON.ToString(), phrase
                                       .getFeature(Feature.PERSON.ToString()));
                headElement.setFeature(Feature.POSSESSIVE.ToString(), phrase
                                       .getFeature(Feature.POSSESSIVE.ToString()));
                headElement.setFeature(Feature.PASSIVE.ToString(), phrase
                                       .getFeature(Feature.PASSIVE.ToString()));
                var currentElement = parent.realise(headElement);
                currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(),
                                          DiscourseFunction.SUBJECT);
                realisedElement.addComponent(currentElement);
            }
        }
Esempio n. 3
0
        /**
         * Realises the specifier of the noun phrase.
         *
         * @param phrase
         *            the <code>PhraseElement</code> representing this noun phrase.
         * @param parent
         *            the parent <code>SyntaxProcessor</code> that will do the
         *            realisation of the complementiser.
         * @param realisedElement
         *            the current realisation of the noun phrase.
         */

        private static void realiseSpecifier(PhraseElement phrase,
                                             SyntaxProcessor parent, ListElement realisedElement)
        {
            INLGElement specifierElement = phrase
                                           .getFeatureAsElement(InternalFeature.SPECIFIER.ToString());

            if (specifierElement != null &&
                !phrase.getFeatureAsBoolean(InternalFeature.RAISED.ToString()) &&
                !phrase.getFeatureAsBoolean(Feature.ELIDED.ToString()))
            {
                if (!specifierElement.isA(LexicalCategoryEnum.PRONOUN) &&
                    specifierElement.getCategory().enumType != (int)PhraseCategoryEnum.NOUN_PHRASE)
                {
                    specifierElement.setFeature(Feature.NUMBER.ToString(), phrase
                                                .getFeature(Feature.NUMBER.ToString()));
                }

                var currentElement = parent.realise(specifierElement);

                if (currentElement != null)
                {
                    currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(),
                                              DiscourseFunction.SPECIFIER);
                    realisedElement.addComponent(currentElement);
                }
            }
        }
Esempio n. 4
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));
            }
        }
Esempio n. 5
0
        /**
         * Realises the verb part of the clause.
         *
         * @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 splitVerb
         *            an <code>NLGElement</code> representing the subjects that
         *            should split the verb
         * @param verbElement
         *            the <code>NLGElement</code> representing the verb phrase for
         *            this clause.
         * @param whObj
         *            whether the VP is part of an object WH-interrogative
         */

        private static void realiseVerb(PhraseElement phrase,
                                        SyntaxProcessor parent,
                                        ListElement realisedElement,
                                        INLGElement splitVerb,
                                        INLGElement verbElement,
                                        bool whObj)
        {
            setVerbFeatures(phrase, verbElement);

            var currentElement = parent.realise(verbElement);

            if (currentElement != null)
            {
                if (splitVerb == null)
                {
                    currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(), DiscourseFunction.VERB_PHRASE);

                    realisedElement.addComponent(currentElement);
                }
                else
                {
                    if (currentElement is ListElement)
                    {
                        var children = currentElement.getChildren();
                        currentElement = children[0];
                        currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(), DiscourseFunction.VERB_PHRASE);
                        realisedElement.addComponent(currentElement);
                        realisedElement.addComponent(splitVerb);

                        for (var eachChild = 1; eachChild < children.Count; eachChild++)
                        {
                            currentElement = children[eachChild];
                            currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(), DiscourseFunction.VERB_PHRASE);
                            realisedElement.addComponent(currentElement);
                        }
                    }
                    else
                    {
                        currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(), DiscourseFunction.VERB_PHRASE);

                        if (whObj)
                        {
                            realisedElement.addComponent(currentElement);
                            realisedElement.addComponent(splitVerb);
                        }
                        else
                        {
                            realisedElement.addComponent(splitVerb);
                            realisedElement.addComponent(currentElement);
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        /**
         * Adds a <em>do</em> verb to the realisation of this clause.
         *
         * @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 addDoAuxiliary(PhraseElement phrase,
                                           SyntaxProcessor parent,
                                           NLGFactory phraseFactory,
                                           ListElement realisedElement)
        {
            PhraseElement doPhrase = phraseFactory.createVerbPhrase("do");

            doPhrase.setFeature(Feature.TENSE.ToString(), phrase.getFeatureTense(Feature.TENSE.ToString()));
            doPhrase.setFeature(Feature.PERSON.ToString(), phrase.getFeature(Feature.PERSON.ToString()));
            doPhrase.setFeature(Feature.NUMBER.ToString(), phrase.getFeature(Feature.NUMBER.ToString()));
            realisedElement.addComponent(parent.realise(doPhrase));
        }
Esempio n. 7
0
        /**
         * Pushes the particles of the main verb onto the verb group stack.
         *
         * @param phrase
         *            the <code>PhraseElement</code> representing this noun phrase.
         * @param parent
         *            the parent <code>SyntaxProcessor</code> that will do the
         *            realisation of the complementiser.
         * @param vgComponents
         *            the stack of verb components in the verb group.
         */

        private static void pushParticles(PhraseElement phrase,
                                          SyntaxProcessor parent, Stack <INLGElement> vgComponents)
        {
            var particle = phrase.getFeature(Feature.PARTICLE.ToString());

            if (particle is string)
            {
                vgComponents.push(new StringElement((string)particle));
            }
            else if (particle is INLGElement)
            {
                vgComponents.push(parent.realise((INLGElement)particle));
            }
        }
Esempio n. 8
0
        /**
         * Realises the auxiliary verbs in the verb group.
         *
         * @param parent
         *            the parent <code>SyntaxProcessor</code> that will do the
         *            realisation of the complementiser.
         * @param realisedElement
         *            the current realisation of the noun phrase.
         * @param auxiliaryRealisation
         *            the stack of auxiliary verbs.
         */

        private static void realiseAuxiliaries(SyntaxProcessor parent,
                                               ListElement realisedElement, Stack <INLGElement> auxiliaryRealisation)
        {
            while (!auxiliaryRealisation.isEmpty())
            {
                var aux            = auxiliaryRealisation.pop();
                var currentElement = parent.realise(aux);
                if (currentElement != null)
                {
                    realisedElement.addComponent(currentElement);
                    currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(),
                                              DiscourseFunction.AUXILIARY);
                }
            }
        }
Esempio n. 9
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);
                }
            }
        }
Esempio n. 10
0
        /**
         * Realises the main group of verbs in the phrase.
         *
         * @param parent
         *            the parent <code>SyntaxProcessor</code> that will do the
         *            realisation of the complementiser.
         * @param phrase
         *            the <code>PhraseElement</code> representing this noun phrase.
         * @param mainVerbRealisation
         *            the stack of the main verbs in the phrase.
         * @param realisedElement
         *            the current realisation of the noun phrase.
         */

        private static void realiseMainVerb(SyntaxProcessor parent,
                                            PhraseElement phrase, Stack <INLGElement> mainVerbRealisation,
                                            ListElement realisedElement)
        {
            while (!mainVerbRealisation.isEmpty())
            {
                var main = mainVerbRealisation.pop();
                main.setFeature(Feature.INTERROGATIVE_TYPE.ToString(), phrase
                                .getFeature(Feature.INTERROGATIVE_TYPE.ToString()));
                var currentElement = parent.realise(main);

                if (currentElement != null)
                {
                    realisedElement.addComponent(currentElement);
                }
            }
        }
Esempio n. 11
0
        /**
         * Realises the complements of this phrase.
         *
         * @param parent
         *            the parent <code>SyntaxProcessor</code> that will do the
         *            realisation of the complementiser.
         * @param phrase
         *            the <code>PhraseElement</code> representing this noun phrase.
         * @param realisedElement
         *            the current realisation of the noun phrase.
         */

        private static void realiseComplements(SyntaxProcessor parent,
                                               PhraseElement phrase, ListElement realisedElement)
        {
            var indirects = new ListElement();
            var directs   = new ListElement();
            var unknowns  = new ListElement();

            foreach (INLGElement complement in phrase.getFeatureAsElementList(InternalFeature.COMPLEMENTS.ToString()))
            {
                var discourseValue = complement
                                     .getFeature(InternalFeature.DISCOURSE_FUNCTION.ToString());
                var currentElement = parent.realise(complement);
                if (currentElement != null)
                {
                    currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(),
                                              DiscourseFunction.COMPLEMENT);

                    if (DiscourseFunction.INDIRECT_OBJECT.Equals(discourseValue))
                    {
                        indirects.addComponent(currentElement);
                    }
                    else if (DiscourseFunction.OBJECT.Equals(discourseValue))
                    {
                        directs.addComponent(currentElement);
                    }
                    else
                    {
                        unknowns.addComponent(currentElement);
                    }
                }
            }
            if (!InterrogativeTypeExtensions.isIndirectObject(phrase
                                                              .getFeature(Feature.INTERROGATIVE_TYPE.ToString())))
            {
                realisedElement.addComponents(indirects.getChildren());
            }
            if (!phrase.getFeatureAsBoolean(Feature.PASSIVE.ToString()))
            {
                if (!InterrogativeTypeExtensions.isAndObject(phrase
                                                             .getFeature(Feature.INTERROGATIVE_TYPE.ToString())))
                {
                    realisedElement.addComponents(directs.getChildren());
                }
                realisedElement.addComponents(unknowns.getChildren());
            }
        }
Esempio n. 12
0
        public INLGElement realise(INLGElement phrase1, INLGElement phrase2)
        {
            INLGElement result = null;

            if (phrase1 is PhraseElement &&
                phrase2 is  PhraseElement &&
                phrase1.getCategory().enumType == (int)PhraseCategoryEnum.CLAUSE &&
                phrase2.getCategory().enumType == (int)PhraseCategoryEnum.CLAUSE)
            {
                var funcSets = AggregationHelper.collectFunctionalPairs(_syntax.realise(phrase1), _syntax.realise(phrase2));

                applyForwardConjunctionReduction(funcSets);
                applyBackwardConjunctionReduction(funcSets);
                result = _factory.createCoordinatedPhrase(phrase1, phrase2);
            }

            return(result);
        }
Esempio n. 13
0
        /**
         * Adds the front modifiers to the end of the clause when dealing with
         * interrogatives.
         *
         * @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.
         */

        private static void addInterrogativeFrontModifiers(PhraseElement phrase,
                                                           SyntaxProcessor parent,
                                                           ListElement realisedElement)
        {
            INLGElement currentElement = null;

            if (phrase.hasFeature(Feature.INTERROGATIVE_TYPE.ToString()))
            {
                foreach (var subject in phrase.getFeatureAsElementList(InternalFeature.FRONT_MODIFIERS.ToString()))
                {
                    currentElement = parent.realise(subject);
                    if (currentElement != null)
                    {
                        currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(), DiscourseFunction.FRONT_MODIFIER);

                        realisedElement.addComponent(currentElement);
                    }
                }
            }
        }
Esempio n. 14
0
        /**
         * Realises the subjects for the clause.
         *
         * @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.
         */

        private static ListElement realiseSubjects(PhraseElement phrase, SyntaxProcessor parent)
        {
            INLGElement currentElement  = null;
            var         realisedElement = new ListElement();

            foreach (INLGElement subject in phrase.getFeatureAsElementList(InternalFeature.SUBJECTS.ToString()))
            {
                subject.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(), DiscourseFunction.SUBJECT);
                if (Form.GERUND.Equals(phrase.getFeature(Feature.FORM.ToString())) &&
                    !phrase.getFeatureAsBoolean(Feature.SUPPRESS_GENITIVE_IN_GERUND.ToString()))
                {
                    subject.setFeature(Feature.POSSESSIVE.ToString(), true);
                }
                currentElement = parent.realise(subject);
                if (currentElement != null)
                {
                    realisedElement.addComponent(currentElement);
                }
            }
            return(realisedElement);
        }
Esempio n. 15
0
        public override INLGElement realise(INLGElement element)
        {
            var debug = new StringBuilder();

            if (this.debug)
            {
                Debug.WriteLine("INITIAL TREE\n");
                Debug.WriteLine(element.printTree(null));
                debug.append("INITIAL TREE<br/>");
                debug.append(element.printTree("&nbsp;&nbsp;").replaceAll(@"\n", "<br/>"));
            }

            var postSyntax = syntax.realise(element);

            if (this.debug)
            {
                Debug.WriteLine("<br/>POST-SYNTAX TREE<br/>");
                Debug.WriteLine(postSyntax.printTree(null));
                debug.append("<br/>POST-SYNTAX TREE<br/>");
                debug.append(postSyntax.printTree("&nbsp;&nbsp;").replaceAll(@"\n", "<br/>"));
            }

            var postMorphology = morphology.realise(postSyntax);

            if (this.debug)
            {
                Debug.WriteLine("\nPOST-MORPHOLOGY TREE\n");
                Debug.WriteLine(postMorphology.printTree(null));
                debug.append("<br/>POST-MORPHOLOGY TREE<br/>");
                debug.append(postMorphology.printTree("&nbsp;&nbsp;").replaceAll(@"\n", "<br/>"));
            }

            var postOrthography = orthography.realise(postMorphology);

            if (this.debug)
            {
                Debug.WriteLine("\nPOST-ORTHOGRAPHY TREE\n");
                Debug.WriteLine(postOrthography.printTree(null));
                debug.append("<br/>POST-ORTHOGRAPHY TREE<br/>");
                debug.append(postOrthography.printTree("&nbsp;&nbsp;").replaceAll(@"\n", "<br/>"));
            }

            INLGElement postFormatter = null;

            if (formatter != null)
            {
                postFormatter = formatter.realise(postOrthography);
                if (this.debug)
                {
                    Debug.WriteLine("\nPOST-FORMATTER TREE\n");
                    Debug.WriteLine(postFormatter.printTree(null));
                    debug.append("<br/>POST-FORMATTER TREE<br/>");
                    debug.append(postFormatter.printTree("&nbsp;&nbsp;").replaceAll(@"\n", "<br/>"));
                }
            }
            else
            {
                postFormatter = postOrthography;
            }

            if (this.debug)
            {
                postFormatter.setFeature("debug", debug.ToString());
            }

            return(postFormatter);
        }
Esempio n. 16
0
        /**
         * Realises the complements of passive clauses; also sets number, person for
         * passive
         *
         * @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 verbElement
         *            the <code>NLGElement</code> representing the verb phrase for
         *            this clause.
         */

        private static INLGElement addPassiveComplementsNumberPerson(PhraseElement phrase,
                                                                     SyntaxProcessor parent,
                                                                     ListElement realisedElement,
                                                                     INLGElement verbElement)
        {
            object      passiveNumber  = null;
            object      passivePerson  = null;
            INLGElement currentElement = null;
            INLGElement splitVerb      = null;
            var         verbPhrase     = phrase.getFeatureAsElement(InternalFeature.VERB_PHRASE.ToString());

            // count complements to set plural feature if more than one
            var numComps  = 0;
            var coordSubj = false;

            if (phrase.getFeatureAsBoolean(Feature.PASSIVE.ToString()) && verbPhrase != null &&
                !InterrogativeType.WHAT_OBJECT.Equals(phrase.getFeature(Feature.INTERROGATIVE_TYPE.ToString())))
            {
                // complements of a clause are stored in the VPPhraseSpec
                foreach (var subject in verbPhrase.getFeatureAsElementList(InternalFeature.COMPLEMENTS.ToString()))
                {
                    // AG: complement needn't be an NP
                    // subject.isA(PhraseCategory.NOUN_PHRASE) &&
                    if (DiscourseFunction.OBJECT.Equals(subject.getFeature(InternalFeature.DISCOURSE_FUNCTION.ToString())))
                    {
                        subject.setFeature(Feature.PASSIVE.ToString(), true);
                        numComps++;
                        currentElement = parent.realise(subject);

                        if (currentElement != null)
                        {
                            currentElement.setFeature(InternalFeature.DISCOURSE_FUNCTION.ToString(), DiscourseFunction.OBJECT);

                            if (phrase.hasFeature(Feature.INTERROGATIVE_TYPE.ToString()))
                            {
                                splitVerb = currentElement;
                            }
                            else
                            {
                                realisedElement.addComponent(currentElement);
                            }
                        }

                        // flag if passive subject is coordinated with an "and"
                        if (!coordSubj && subject is CoordinatedPhraseElement)
                        {
                            var conj = ((CoordinatedPhraseElement)subject).getConjunction();
                            coordSubj = (conj != null && conj.Equals("and"));
                        }

                        if (passiveNumber == null)
                        {
                            passiveNumber = subject.getFeature(Feature.NUMBER.ToString());
                        }
                        else
                        {
                            passiveNumber = NumberAgreement.PLURAL;
                        }

                        if (Person.FIRST.Equals(subject.getFeature(Feature.PERSON.ToString())))
                        {
                            passivePerson = Person.FIRST;
                        }
                        else if (Person.SECOND.Equals(subject.getFeature(Feature.PERSON.ToString())) &&
                                 !Person.FIRST.Equals(passivePerson))
                        {
                            passivePerson = Person.SECOND;
                        }
                        else if (passivePerson == null)
                        {
                            passivePerson = Person.THIRD;
                        }

                        if (Form.GERUND.Equals(phrase.getFeature(Feature.FORM.ToString())) &&
                            !phrase.getFeatureAsBoolean(Feature.SUPPRESS_GENITIVE_IN_GERUND.ToString()))
                        {
                            subject.setFeature(Feature.POSSESSIVE.ToString(), true);
                        }
                    }
                }
            }

            if (verbElement != null)
            {
                if (passivePerson != null)
                {
                    verbElement.setFeature(Feature.PERSON.ToString(), passivePerson);
                    // below commented out. for non-passive, number and person set
                    // by checkSubjectNumberPerson
                    // } else {
                    // verbElement.setFeature(Feature.PERSON, phrase
                    // .getFeature(Feature.PERSON));
                }

                if (numComps > 1 || coordSubj)
                {
                    verbElement.setFeature(Feature.NUMBER.ToString(), NumberAgreement.PLURAL);
                }
                else if (passiveNumber != null)
                {
                    verbElement.setFeature(Feature.NUMBER.ToString(), passiveNumber);
                }
            }
            return(splitVerb);
        }
Esempio n. 17
0
        /**
         * The main method for realising coordinated phrases.
         *
         * @param parent
         *            the <code>SyntaxProcessor</code> that called this method.
         * @param phrase
         *            the <code>CoordinatedPhrase</code> to be realised.
         * @return the realised <code>NLGElement</code>.
         */

        public static INLGElement realise(SyntaxProcessor parent,
                                          CoordinatedPhraseElement phrase)
        {
            ListElement realisedElement = null;

            if (phrase != null)
            {
                realisedElement = new ListElement();
                PhraseHelper.realiseList(parent, realisedElement, phrase
                                         .getPreModifiers(), DiscourseFunction.PRE_MODIFIER);

                var coordinated = new CoordinatedPhraseElement();

                List <INLGElement> children = phrase.getChildren();
                var conjunction             = phrase.getFeatureAsString(Feature.CONJUNCTION.ToString());
                coordinated.setFeature(Feature.CONJUNCTION.ToString(), conjunction);
                coordinated.setFeature(Feature.CONJUNCTION_TYPE.ToString(), phrase
                                       .getFeature(Feature.CONJUNCTION_TYPE.ToString()));

                InflectedWordElement conjunctionElement = null;

                if (children != null && children.size() > 0)
                {
                    if (phrase.getFeatureAsBoolean(Feature.RAISE_SPECIFIER.ToString())
                        )
                    {
                        raiseSpecifier(children);
                    }

                    var child = phrase.getLastCoordinate();
                    if (child is SPhraseSpec)
                    {
                        ((SPhraseSpec)child).setFeature(Feature.POSSESSIVE.ToString(), phrase
                                                        .getFeature(Feature.POSSESSIVE.ToString()));
                    }
                    else
                    {
                        child.setFeature(Feature.POSSESSIVE.ToString(), phrase
                                         .getFeature(Feature.POSSESSIVE.ToString()));
                    }

                    child = children.get(0);

                    setChildFeatures(phrase, child);

                    coordinated.addCoordinate(parent.realise(child));
                    for (var index = 1; index < children.size(); index++)
                    {
                        child = children.get(index);
                        setChildFeatures(phrase, child);
                        if (child is SPhraseSpec)
                        {
                            if (phrase.getFeatureAsBoolean(Feature.AGGREGATE_AUXILIARY.ToString())
                                )
                            {
                                ((SPhraseSpec)child).setFeature(InternalFeature.REALISE_AUXILIARY.ToString(),
                                                                false);
                            }
                        }
                        else
                        {
                            if (phrase.getFeatureAsBoolean(Feature.AGGREGATE_AUXILIARY.ToString())
                                )
                            {
                                child.setFeature(InternalFeature.REALISE_AUXILIARY.ToString(),
                                                 false);
                            }
                        }

                        if (child.isA(PhraseCategoryEnum.CLAUSE))
                        {
                            ((SPhraseSpec)child)
                            .setFeature(
                                Feature.SUPRESSED_COMPLEMENTISER.ToString(),
                                phrase
                                .getFeature(Feature.SUPRESSED_COMPLEMENTISER.ToString()));
                        }

                        //skip conjunction if it's null or empty string
                        if (conjunction != null && conjunction.length() > 0)
                        {
                            conjunctionElement = new InflectedWordElement(
                                conjunction, new LexicalCategory_CONJUNCTION());
                            conjunctionElement.setFeature(
                                InternalFeature.DISCOURSE_FUNCTION.ToString(),
                                DiscourseFunction.CONJUNCTION);
                            coordinated.addCoordinate(conjunctionElement);
                        }

                        coordinated.addCoordinate(parent.realise(child));
                    }
                    realisedElement.addComponent(coordinated);
                }

                PhraseHelper.realiseList(parent, realisedElement, phrase
                                         .getPostModifiers(), DiscourseFunction.POST_MODIFIER);
                PhraseHelper.realiseList(parent, realisedElement, phrase
                                         .getComplements(), DiscourseFunction.COMPLEMENT);
            }
            return(realisedElement);
        }