Examples of NLGElement


Examples of simplenlg.framework.NLGElement

        }
      }
    }

    pushParticles(phrase, parent, vgComponents);
    NLGElement frontVG = grabHeadVerb(phrase, tenseValue, modal != null);
    checkImperativeInfinitive(formValue, frontVG);

    if (phrase.getFeatureAsBoolean(Feature.PASSIVE).booleanValue()) {
      frontVG = addBe(frontVG, vgComponents, Form.PAST_PARTICIPLE);
    }
View Full Code Here

Examples of simplenlg.framework.NLGElement

   *            the phrase has a modal
   * @return the new element for the front of the group.
   */
  private static NLGElement createNot(PhraseElement phrase,
      Stack<NLGElement> vgComponents, NLGElement frontVG, boolean hasModal) {
    NLGElement newFront = frontVG;

    if (phrase.getFeatureAsBoolean(Feature.NEGATED).booleanValue()) {
      NLGFactory factory = phrase.getFactory();

      if (!vgComponents.empty() || frontVG != null && isCopular(frontVG)) {
View Full Code Here

Examples of simplenlg.framework.NLGElement

   */
  private static NLGElement pushIfModal(boolean hasModal,
      PhraseElement phrase, NLGElement frontVG,
      Stack<NLGElement> vgComponents) {

    NLGElement newFront = frontVG;
    if (hasModal
        && !phrase.getFeatureAsBoolean(InternalFeature.IGNORE_MODAL)
            .booleanValue()) {
      if (frontVG != null) {
        frontVG.setFeature(InternalFeature.NON_MORPH, true);
View Full Code Here

Examples of simplenlg.framework.NLGElement

   *            the <code>Tense</code> of the phrase.
   * @return the new element for the front of the group.
   */
  private static NLGElement addHave(NLGElement frontVG,
      Stack<NLGElement> vgComponents, String modal, Tense tenseValue) {
    NLGElement newFront = frontVG;

    if (frontVG != null) {
      frontVG.setFeature(Feature.FORM, Form.PAST_PARTICIPLE);
      vgComponents.push(frontVG);
    }
    newFront = new InflectedWordElement("have", LexicalCategory.VERB); //$NON-NLS-1$
    newFront.setFeature(Feature.TENSE, tenseValue);
    if (modal != null) {
      newFront.setFeature(InternalFeature.NON_MORPH, true);
    }
    return newFront;
  }
View Full Code Here

Examples of simplenlg.framework.NLGElement

   *            <code>true</code> if the verb phrase has a modal.
   * @return the modified head element
   */
  private static NLGElement grabHeadVerb(PhraseElement phrase,
      Tense tenseValue, boolean hasModal) {
    NLGElement frontVG = phrase.getHead();

    if (frontVG != null) {
      if (frontVG instanceof WordElement) {
        frontVG = new InflectedWordElement((WordElement) frontVG);
      }

      //AG: tense value should always be set on frontVG
      if (tenseValue != null) {
        frontVG.setFeature(Feature.TENSE, tenseValue);
      }

      // if (Tense.FUTURE.equals(tenseValue) && frontVG != null) {
      // frontVG.setFeature(Feature.TENSE, Tense.FUTURE);
      // }

      if (hasModal) {
        frontVG.setFeature(Feature.NEGATED, false);
      }
    }

    return frontVG;
  }
View Full Code Here

Examples of simplenlg.framework.NLGElement

   * @return <code>true</code> if any of the complements are plural.
   */
  private static boolean hasPluralComplement(List<NLGElement> complements) {
    boolean plural = false;
    Iterator<NLGElement> complementIterator = complements.iterator();
    NLGElement eachComplement = null;
    Object numberValue = null;

    while (complementIterator.hasNext() && !plural) {
      eachComplement = complementIterator.next();

      if (eachComplement != null
          && eachComplement.isA(PhraseCategory.NOUN_PHRASE)) {

        numberValue = eachComplement.getFeature(Feature.NUMBER);
        if (numberValue != null
            && NumberAgreement.PLURAL.equals(numberValue)) {
          plural = true;
        }
      }
View Full Code Here

Examples of simplenlg.framework.NLGElement

      copular = "be".equalsIgnoreCase(((WordElement) element) //$NON-NLS-1$
          .getBaseForm());

    } else if (element instanceof PhraseElement) {
      // get the head and check if it's "be"
      NLGElement head = element instanceof SPhraseSpec ? ((SPhraseSpec) element)
          .getVerb()
          : ((PhraseElement) element).getHead();

      if (head != null) {
        copular = (head instanceof WordElement && "be"
View Full Code Here

Examples of simplenlg.framework.NLGElement

   * is a coordinated phrase, whose children can be further aggregated.
   *
   */
  @Override
  public NLGElement realise(NLGElement element) {
    NLGElement result = element;

    for (AggregationRule rule : this._rules) {
      NLGElement intermediate = rule.apply(result);

      if (intermediate != null) {
        result = intermediate;
      }
    }
View Full Code Here

Examples of simplenlg.framework.NLGElement

    // Do nothing
  }

  @Override
  public NLGElement realise(NLGElement element) {
    NLGElement realisedElement = null;

    if (element != null
        && !element.getFeatureAsBoolean(Feature.ELIDED).booleanValue()) {

      if (element instanceof DocumentElement) {
View Full Code Here

Examples of simplenlg.framework.NLGElement

  }

  @Override
  public List<NLGElement> realise(List<NLGElement> elements) {
    List<NLGElement> realisedList = new ArrayList<NLGElement>();
    NLGElement childRealisation = null;

    if (elements != null) {
      for (NLGElement eachElement : elements) {
        if (eachElement != null) {
          childRealisation = realise(eachElement);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.