コード例 #1
0
  /* TODO:on fait qqch: Let's eat? */
  public void _test_on_mangera() {
    ArrayList<PicWordAction> phrases = new ArrayList<PicWordAction>();
    phrases.add(new PicWordAction("on", Pic2NLG.ActionType.NOUN));
    phrases.add(new PicWordAction("manger", Pic2NLG.ActionType.VERB));
    phrases.add(new PicWordAction("future", Pic2NLG.ActionType.TENSE_PRESENT));

    assertEquals("On mangera", converter.convertPhrasesToNLG(phrases));
  }
コード例 #2
0
  /* object not specified directly */
  public void test_tu_es_joli() {
    ArrayList<PicWordAction> phrases = new ArrayList<PicWordAction>();
    phrases.add(new PicWordAction("you", Pic2NLG.ActionType.NOUN));
    phrases.add(new PicWordAction("be", Pic2NLG.ActionType.VERB));
    phrases.add(new PicWordAction("beautiful", Pic2NLG.ActionType.ADJECTIVE));

    assertEquals("You are beautiful", converter.convertPhrasesToNLG(phrases));
  }
コード例 #3
0
  public void test_remercier_de_explicit() {
    ArrayList<PicWordAction> phrases = get_text_je_veux_vous_remercier(true);

    // TODO: after second noun the context is object!
    // TODO: phrases.add(new PicWordAction("plural",
    // Pic2NLG.ActionType.NUMBER_AGREEMENT));
    assertEquals("I want to thank you for everything", converter.convertPhrasesToNLG(phrases));
  }
コード例 #4
0
  /* tests simple negation */
  public void test_nous_voulons_manger_negated() {
    ArrayList<PicWordAction> phrases = text_je_veux_manger();

    phrases.set(0, new PicWordAction("We", Pic2NLG.ActionType.NOUN));
    phrases.add(new PicWordAction("true", Pic2NLG.ActionType.NEGATED));

    assertEquals("We do not want to eat", converter.convertPhrasesToNLG(phrases));
  }
コード例 #5
0
  /* object not specified directly */
  public void ntest_il_court_tres_viteadverb_phrase() {
    ArrayList<PicWordAction> phrases = new ArrayList<PicWordAction>();
    phrases.add(new PicWordAction("he", Pic2NLG.ActionType.NOUN));
    phrases.add(new PicWordAction("run", Pic2NLG.ActionType.VERB));
    phrases.add(new PicWordAction("very", Pic2NLG.ActionType.ADVERB));
    phrases.add(new PicWordAction("quickly", Pic2NLG.ActionType.ADVERB));

    assertEquals("He runs very quickly", converter.convertPhrasesToNLG(phrases));
  }
コード例 #6
0
  /* object not specified directly */
  public void _NOT_IMPORTANT_test_il_court_tres_tres_viteadverb_phrase() {
    ArrayList<PicWordAction> phrases = new ArrayList<PicWordAction>();
    phrases.add(new PicWordAction("il", Pic2NLG.ActionType.NOUN));
    phrases.add(new PicWordAction("courir", Pic2NLG.ActionType.VERB));
    phrases.add(new PicWordAction("très", Pic2NLG.ActionType.ADVERB));
    phrases.add(new PicWordAction("très", Pic2NLG.ActionType.ADVERB));

    phrases.add(new PicWordAction("vite", Pic2NLG.ActionType.ADVERB));

    assertEquals("Il court très très vite", converter.convertPhrasesToNLG(phrases));
  }
コード例 #7
0
  /*
   * TODO: Let's go to sleep. reflexive verbs -- use of reflexive verb +
   * future proche
   */
  public void _test_lets_go_to_sleep() {
    ArrayList<PicWordAction> phrases = new ArrayList<PicWordAction>();
    phrases.add(new PicWordAction("on", Pic2NLG.ActionType.NOUN));

    NLGElement se_coucher = Pic2NLG.factory.createNLGElement("coucher");
    se_coucher.setFeature(LexicalFeature.REFLEXIVE, true);

    phrases.add(new PicWordAction(se_coucher, Pic2NLG.ActionType.VERB));
    phrases.add(new PicWordAction("futur_proche", Pic2NLG.ActionType.TENSE_PRESENT));

    assertEquals("On va se coucher", converter.convertPhrasesToNLG(phrases));
  }
コード例 #8
0
  public void _test_je_veux_manger_negated_de_object() {
    ArrayList<PicWordAction> phrases = text_je_veux_manger();
    phrases.add(new PicWordAction("true", Pic2NLG.ActionType.NEGATED));
    // TODO: this is not grammatically correct in case of manger

    NPPhraseSpec noun = Pic2NLG.factory.createNounPhrase("soupe");
    // TODO: try to determine the determiner automatically
    noun.setDeterminer("de");
    phrases.add(new PicWordAction(noun, Pic2NLG.ActionType.NOUN));
    // TODO: after second noun the context is object!
    // TODO: phrases.add(new PicWordAction("plural",
    // Pic2NLG.ActionType.NUMBER_AGREEMENT));
    assertEquals("Je ne veux pas manger de soupe", converter.convertPhrasesToNLG(phrases));
  }
コード例 #9
0
  /* tests simple negation */
  public void test_nous_voulons_manger_multi_objects() {
    ArrayList<PicWordAction> phrases = text_je_veux_manger();

    phrases.set(0, new PicWordAction("We", Pic2NLG.ActionType.NOUN));

    phrases.add(new PicWordAction("potatoes", Pic2NLG.ActionType.NOUN));
    phrases.add(new PicWordAction("fish", Pic2NLG.ActionType.NOUN));
    phrases.add(new PicWordAction("cabage", Pic2NLG.ActionType.NOUN));

    phrases.add(new PicWordAction("carrots", Pic2NLG.ActionType.NOUN));

    // some, '', or the
    assertEquals("We want to eat potatoes, fish, carrots", converter.convertPhrasesToNLG(phrases));
  }
コード例 #10
0
  /*
   * determinants - un, une, le, la, les TODO: note! the gender matters only
   * on the Noun not it's specifier! e.g. one may feed le chatte --> will be
   * fixed --> la chatte
   */
  public void test_le_chat_determinants() {
    ArrayList<PicWordAction> phrases = new ArrayList<PicWordAction>();

    phrases.add(
        new PicWordAction(Pic2NLG.factory.createNounPhrase("the", "cat"), Pic2NLG.ActionType.NOUN));

    VPPhraseSpec verb = Pic2NLG.factory.createVerbPhrase("sleep");
    // verb.setFeature(LexicalFeature.REFLEXIVE, true);

    phrases.add(new PicWordAction(verb, Pic2NLG.ActionType.VERB));
    phrases.add(new PicWordAction("futur_proche", Pic2NLG.ActionType.TENSE_PRESENT));

    assertEquals("The cat goes to sleep", converter.convertPhrasesToNLG(phrases));
  }
コード例 #11
0
  /**
   * Plural test + [ default prep? De ] bonbons
   *
   * <p>Default prepositions may be: manger - de; aller - a; DE:
   * http://french.about.com/library/prepositions/bl_prep_de_verb.htm TODO: A + Verb Inf:
   * http://french.about.com/library/prepositions/bl_prep_a_verb.htm TODO: A + Indirect Object:
   * http://french.about.com/library/prepositions/bl_prep_a_verb2.htm etc
   *
   * <p>TODO: can we figure out default preposition and what if more probable to have a plural or
   * singular for a certain phrase? I'm afraid that involves complex semantic decisions... see
   * grammar check tools!
   */
  public void _test_je_veux_manger_negated_de_object_plural() {
    ArrayList<PicWordAction> phrases = text_je_veux_manger();
    phrases.add(new PicWordAction("true", Pic2NLG.ActionType.NEGATED));

    NPPhraseSpec noun = Pic2NLG.factory.createNounPhrase("bonbon");
    noun.setPlural(true);
    // TODO: try to determine the determiner automatically
    noun.setDeterminer("de");

    phrases.add(new PicWordAction(noun, Pic2NLG.ActionType.NOUN));

    // TODO: after second noun the context is the object!
    phrases.add(new PicWordAction("plural", Pic2NLG.ActionType.NUMBER_AGREEMENT));
    assertEquals("Je ne veux pas manger de bonbons", converter.convertPhrasesToNLG(phrases));
  }
コード例 #12
0
  public void test_on_va_partir_de_Nice_de_NounIndObj_auto() {
    ArrayList<PicWordAction> phrases = new ArrayList<PicWordAction>();

    phrases.add(new PicWordAction("we", Pic2NLG.ActionType.NOUN));
    phrases.add(new PicWordAction("leave", Pic2NLG.ActionType.VERB));
    phrases.add(new PicWordAction("futur_proche", Pic2NLG.ActionType.TENSE_PRESENT));

    NPPhraseSpec noun = Pic2NLG.factory.createNounPhrase("Nice");
    // TODO: try to determine the determiner automatically
    // noun.setDeterminer("de");
    phrases.add(new PicWordAction(noun, Pic2NLG.ActionType.NOUN));
    // TODO: after second noun the context is object!
    // TODO: phrases.add(new PicWordAction("plural",
    // Pic2NLG.ActionType.NUMBER_AGREEMENT));
    assertEquals("We are going to leave Nice", converter.convertPhrasesToNLG(phrases));
  }
コード例 #13
0
  public void test_je_veux_manger_a_automatically() {
    ArrayList<PicWordAction> phrases = new ArrayList<PicWordAction>();

    phrases.add(new PicWordAction("I", Pic2NLG.ActionType.NOUN));
    phrases.add(new PicWordAction("live", Pic2NLG.ActionType.VERB));
    phrases.add(new PicWordAction("futur_proche", Pic2NLG.ActionType.TENSE_PRESENT));

    NPPhraseSpec noun = Pic2NLG.factory.createNounPhrase("Paris");
    // TODO: try to determine the determiner automatically
    // noun.setDeterminer("a");
    phrases.add(new PicWordAction(noun, Pic2NLG.ActionType.NOUN));
    // TODO: after second noun the context is object!
    // TODO: phrases.add(new PicWordAction("plural",
    // Pic2NLG.ActionType.NUMBER_AGREEMENT));
    assertEquals("I am going to live in Paris", converter.convertPhrasesToNLG(phrases));
  }
コード例 #14
0
  /** Test the genders of multi-gender words, like chanteuse */
  public void _test_je_veux_etre_chanteuse_gender() {
    ArrayList<PicWordAction> phrases = new ArrayList<PicWordAction>();
    // je avoir [past] assez bonbon [plural] ==> j'ai eu assez des bonbons
    phrases.add(new PicWordAction("je", Pic2NLG.ActionType.NOUN));
    phrases.add(new PicWordAction("vouloir", Pic2NLG.ActionType.VERB));

    // phrases.add(new PicWordAction("past", Pic2NLG.wordTYPE.TENSE));
    phrases.add(new PicWordAction("etre", Pic2NLG.ActionType.VERB));

    NLGElement chanteuse = Pic2NLG.factory.createNounPhrase("un", "chanteur");
    chanteuse.setFeature(LexicalFeature.GENDER, Gender.FEMININE);

    System.out.println(chanteuse);
    phrases.add(new PicWordAction(chanteuse, Pic2NLG.ActionType.NOUN));

    // TODO: phrases.add(new PicWordAction("plural",
    // Pic2NLG.ActionType.NUMBER_AGREEMENT));
    assertEquals("Je veux etre une chanteuse", converter.convertPhrasesToNLG(phrases));
  }
コード例 #15
0
  /**
   * Verbs with: de + verb infinitive, e.g. continuer de faire qqch Indirect object which is action.
   *
   * <p>so we have: [subject + modal+ verb [ de + [ verb + object ] ] ]
   *
   * <p>TODO: futur proche do not work, if a specific modal has already been selected -- double
   * modal.
   */
  public void NOT_IMPORTANT_test_on_va_continuer_de_manger_les_crepes_de_VerbInfin_auto() {
    ArrayList<PicWordAction> phrases = new ArrayList<PicWordAction>();

    phrases.add(new PicWordAction("we", Pic2NLG.ActionType.NOUN));
    phrases.add(new PicWordAction("continuer", Pic2NLG.ActionType.VERB));
    phrases.add(new PicWordAction("eat", Pic2NLG.ActionType.VERB));

    phrases.add(new PicWordAction("futur_proche", Pic2NLG.ActionType.TENSE_PRESENT));

    NPPhraseSpec noun = Pic2NLG.factory.createNounPhrase("pancake");
    noun.setPlural(true);
    // TODO: try to determine the determiner automatically
    // noun.setDeterminer("de");
    phrases.add(new PicWordAction(noun, Pic2NLG.ActionType.NOUN));
    // TODO: after second noun the context is object!
    // TODO: phrases.add(new PicWordAction("plural",
    // Pic2NLG.ActionType.NUMBER_AGREEMENT));
    assertEquals(
        "We are going to continue eating pancakes", converter.convertPhrasesToNLG(phrases));
  }
コード例 #16
0
  public void test_jai_eu_assez_de_bonbons_adjective() {
    ArrayList<PicWordAction> phrases = text_jai_eu_assez_de_bonbons(false);
    phrases.add(new PicWordAction("delitious", Pic2NLG.ActionType.ADJECTIVE));

    assertEquals("I had enough of delitious candies", converter.convertPhrasesToNLG(phrases));
  }
コード例 #17
0
 public void test_jai_eu_assez_de_bonbons_explicit_de() {
   assertEquals(
       "I had enough candies", converter.convertPhrasesToNLG(text_jai_eu_assez_de_bonbons(true)));
 }
コード例 #18
0
 /* a simple phrase with a modal: vouloir, pouvoir, devoir, etc */
 public void test_je_veux_manger() {
   assertEquals("I want to eat", converter.convertPhrasesToNLG(text_je_veux_manger()));
 }