Package simplenlg.framework

Examples of simplenlg.framework.ListElement


   *            the <code>CoordinatedPhrase</code> to be realised.
   * @return the realised <code>NLGElement</code>.
   */
  static NLGElement realise(SyntaxProcessor parent,
      CoordinatedPhraseElement phrase) {
    ListElement realisedElement = null;

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

      CoordinatedPhraseElement coordinated = new CoordinatedPhraseElement();

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

      InflectedWordElement conjunctionElement = null;

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

        NLGElement child = phrase.getLastCoordinate();
        child.setFeature(Feature.POSSESSIVE, phrase
            .getFeature(Feature.POSSESSIVE));

        child = children.get(0);

        setChildFeatures(phrase, child);

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

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

          //skip conjunction if it's null or empty string
          if (conjunction != null && conjunction.length() > 0) {
            conjunctionElement = new InflectedWordElement(
                conjunction, LexicalCategory.CONJUNCTION);
            conjunctionElement.setFeature(
                InternalFeature.DISCOURSE_FUNCTION,
                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
View Full Code Here

TOP

Related Classes of simplenlg.framework.ListElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.