Package simplenlg.framework

Examples of simplenlg.framework.InflectedWordElement


    NLGElement element;
    NLGElement proElement = phraseFactory.createWord(pronoun,
        LexicalCategory.PRONOUN);
   
    if (proElement instanceof WordElement) {
      element = new InflectedWordElement((WordElement) proElement);
      element.setFeature(LexicalFeature.GENDER, ((WordElement) proElement).getFeature(LexicalFeature.GENDER))
      // Ehud - also copy over person
      element.setFeature(Feature.PERSON, ((WordElement) proElement).getFeature(Feature.PERSON))
    } else {
      element = proElement;
View Full Code Here


      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);
          }
View Full Code Here

    // K Kalijurand's test
        String lemma = "walk";


        WordElement word = lexicon.lookupWord(lemma,  LexicalCategory.VERB);
        InflectedWordElement inflectedWord = new InflectedWordElement(word);

        inflectedWord.setFeature(Feature.FORM, Form.PAST_PARTICIPLE);
        String form = realiser.realise(inflectedWord).getRealisation();
        Assert.assertEquals("walked", form);


        inflectedWord = new InflectedWordElement(word);

        inflectedWord.setFeature(Feature.PERSON, Person.THIRD);
        form = realiser.realise(inflectedWord).getRealisation();
        Assert.assertEquals("walks", form);


View Full Code Here

TOP

Related Classes of simplenlg.framework.InflectedWordElement

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.