Package simplenlg.framework

Examples of simplenlg.framework.StringElement


        realisedChild = realise(realisedChild);
        realisation.append(realisedChild.getRealisation()).append(' ');
      }
    }
    realisation.setLength(realisation.length() - 1);
    return new StringElement(realisation.toString().replace(" ,", ",")); //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here


      // String baseForm = ((WordElement) element).getBaseForm();
      String defaultSpell = ((WordElement) element)
          .getDefaultSpellingVariant();

      if (defaultSpell != null) {
        realisedElement = new StringElement(defaultSpell);
      }

    } else if (element instanceof DocumentElement) {
      List<NLGElement> children = element.getChildren();
      ((DocumentElement) element).setComponents(realise(children));
View Full Code Here

   */
  private NLGElement doMorphology(InflectedWordElement element) {
    NLGElement realisedElement = null;
    if (element.getFeatureAsBoolean(InternalFeature.NON_MORPH)
        .booleanValue()) {
      realisedElement = new StringElement(element.getBaseForm());
      realisedElement.setFeature(InternalFeature.DISCOURSE_FUNCTION,
          element.getFeature(InternalFeature.DISCOURSE_FUNCTION));
    } else {
      NLGElement baseWord = element
          .getFeatureAsElement(InternalFeature.BASE_WORD);

      if (baseWord == null && this.lexicon != null) {
        baseWord = this.lexicon.lookupWord(element.getBaseForm());
      }
      ElementCategory category = element.getCategory();
      if (category instanceof LexicalCategory) {
        switch ((LexicalCategory) category) {
        case PRONOUN:
          realisedElement = MorphologyRules
              .doPronounMorphology(element);
          break;

        case NOUN:
          realisedElement = MorphologyRules.doNounMorphology(element,
              (WordElement) baseWord);
          break;

        case VERB:
          realisedElement = MorphologyRules.doVerbMorphology(element,
              (WordElement) baseWord);
          break;

        case ADJECTIVE:
          realisedElement = MorphologyRules.doAdjectiveMorphology(
              element, (WordElement) baseWord);
          break;

        case ADVERB:
          realisedElement = MorphologyRules.doAdverbMorphology(
              element, (WordElement) baseWord);
          break;

        default:
          realisedElement = new StringElement(element.getBaseForm());
          realisedElement
              .setFeature(
                  InternalFeature.DISCOURSE_FUNCTION,
                  element
                      .getFeature(InternalFeature.DISCOURSE_FUNCTION));
View Full Code Here

TOP

Related Classes of simplenlg.framework.StringElement

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.