Examples of NLGFactory


Examples of simplenlg.framework.NLGFactory

  }

  public void initialise() {
    this._syntax = new SyntaxProcessor();
    this._factory = new NLGFactory();
  }
View Full Code Here

Examples of simplenlg.framework.NLGFactory

   */
  private static NLGElement createPronoun(SyntaxProcessor parent,
      PhraseElement phrase) {

    String pronoun = "it"; //$NON-NLS-1$
    NLGFactory phraseFactory = phrase.getFactory();
    Object personValue = phrase.getFeature(Feature.PERSON);

    if (Person.FIRST.equals(personValue)) {
      pronoun = "I"; //$NON-NLS-1$
    } else if (Person.SECOND.equals(personValue)) {
      pronoun = "you"; //$NON-NLS-1$
    } else {
      Object genderValue = phrase.getFeature(LexicalFeature.GENDER);
      if (Gender.FEMININE.equals(genderValue)) {
        pronoun = "she"; //$NON-NLS-1$
      } else if (Gender.MASCULINE.equals(genderValue)) {
        pronoun = "he"; //$NON-NLS-1$
      }
    }
    // AG: createWord now returns WordElement; so we embed it in an
    // inflected word element here
    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))
View Full Code Here

Examples of simplenlg.framework.NLGFactory

    this.s1.setFeature(Feature.TENSE, Tense.PRESENT);
    this.s1
        .setFeature(Feature.INTERROGATIVE_TYPE,
            InterrogativeType.YES_NO);

    NLGFactory docFactory = new NLGFactory(this.lexicon);
    DocumentElement sent = docFactory.createSentence(this.s1);
    Assert.assertEquals("Does the woman kiss the man?", this.realiser //$NON-NLS-1$
        .realise(sent).getRealisation());

    // simple past
    // sentence: "the woman kissed the man"
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.