Exemplo n.º 1
0
 /**
  * Adds the subjects to the beginning of the clause unless the clause is
  * infinitive, imperative or passive, or the subjects split the verb.
  *
  * @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
  */
 private static void addSubjectsToFront(PhraseElement phrase, SyntaxProcessor parent, ListElement realisedElement, NLGElement splitVerb)
 {
     if (!Form.INFINITIVE.Equals(phrase.getFeature(Feature.FORM)) && !Form.IMPERATIVE.Equals(phrase.getFeature(Feature.FORM)) && !phrase.getFeatureAsBoolean(Feature.PASSIVE) && splitVerb == null)
     {
         realisedElement.addComponents(realiseSubjects(phrase, parent).Children);
     }
 }
Exemplo n.º 2
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)
        {
            ListElement indirects      = new ListElement();
            ListElement directs        = new ListElement();
            ListElement unknowns       = new ListElement();
            object      discourseValue = null;
            NLGElement  currentElement = null;

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

                    if (DiscourseFunction.INDIRECT_OBJECT.Equals(discourseValue))
                    {
                        indirects.addComponent(currentElement);
                    }
                    else if (DiscourseFunction.OBJECT.Equals(discourseValue))
                    {
                        directs.addComponent(currentElement);
                    }
                    else
                    {
                        unknowns.addComponent(currentElement);
                    }
                }
            }

            InterrogativeType?interrogativeType = (InterrogativeType?)phrase.getFeature(Feature.INTERROGATIVE_TYPE);

            if (interrogativeType == null || !((InterrogativeType)interrogativeType).isIndirectObject())
            {
                realisedElement.addComponents(indirects.Children);
            }
            if (!phrase.getFeatureAsBoolean(Feature.PASSIVE))
            {
                if (interrogativeType == null || !((InterrogativeType)interrogativeType).isObject())
                {
                    realisedElement.addComponents(directs.Children);
                }
                realisedElement.addComponents(unknowns.Children);
            }
        }