Пример #1
0
    def setUp(self):
        #A young girl with red hair and green eyes is sitting in one of three chairs by the fireplace in the northern part of this room.

        lex_path = os.path.join(os.path.dirname(__file__),
                                '../../res/default-lexicon.xml')
        lex = XMLLexicon(lex_path)
        self.lex = lex

        self.np_a_young_girl = NounPhrase(lex.getWord("girl"),
                                          determiner=lex.getWord("a"),
                                          adjectives=[lex.getWord("young")])
        self.np_red_hair = NounPhrase(
            lex.getWord("hair"), adjectives=[lex.getWord("red", "ADJECTIVE")])
        self.np_glasses = NounPhrase(lex.getWord("glasses"))

        self.pp_with_red_hair_and_glasses = PrepositionalPhrase(
            lex.getWord("with"), [self.np_red_hair, self.np_glasses])

        self.np_the_fire = NounPhrase(lex.getWord("fire", "NOUN"),
                                      determiner=lex.getWord("the"))
        self.pp_by_the_fire = PrepositionalPhrase(
            lex.getWord("by", "PREPOSITION"), [self.np_the_fire])

        self.np_a_young_girl_with_red_hair_and_glasses = NounPhrase.from_nounphrase(
            self.np_a_young_girl,
            prepositional_phrases=[self.pp_with_red_hair_and_glasses])

        self.vp_is_sitting = VerbPhrase(lex.getWord("sit"),
                                        tense="present_progressive")

        self.vp_is_sitting_by_the_fire = VerbPhrase(
            lex.getWord("sit"),
            tense="present_progressive",
            prepositional_phrases=[self.pp_by_the_fire])

        self.np_a_young_girl_with_red_hair_and_glasses_is_sitting = Clause(
            self.np_a_young_girl_with_red_hair_and_glasses, self.vp_is_sitting)

        self.np_a_young_girl_with_red_hair_and_glasses_is_sitting_by_the_fire = Clause(
            self.np_a_young_girl_with_red_hair_and_glasses,
            self.vp_is_sitting_by_the_fire)
Пример #2
0
 def setUp(self):
     #A young girl with red hair and green eyes is sitting in one of three chairs by the fireplace in the northern part of this room.
     lex = XMLLexicon("C:/projects/Python-nlg/res/default-lexicon.xml")
     self.np_a_young_girl = NounPhrase(lex.getWord("girl"), determiner = lex.getWord("a"), adjectives=[lex.getWord("young")])
     self.np_red_hair = NounPhrase(lex.getWord("hair"), adjectives=[lex.getWord("red", "ADJECTIVE")])
     self.np_glasses = NounPhrase(lex.getWord("glasses"))
     
     
     self.pp_with_red_hair_and_glasses = PrepositionalPhrase(lex.getWord("with"), [self.np_red_hair, self.np_glasses])
     
     self.np_the_fire = NounPhrase(lex.getWord("fire", "NOUN"), determiner=lex.getWord("the"))
     self.pp_by_the_fire = PrepositionalPhrase(lex.getWord("by", "PREPOSITION"), [self.np_the_fire])
     
     self.np_a_young_girl_with_red_hair_and_glasses = NounPhrase.from_nounphrase(self.np_a_young_girl, prepositional_phrases = [self.pp_with_red_hair_and_glasses])
     
     self.vp_is_sitting = VerbPhrase(lex.getWord("sit"), tense="present_progressive")
     
     self.vp_is_sitting_by_the_fire = VerbPhrase(lex.getWord("sit"), tense="present_progressive", prepositional_phrases = [self.pp_by_the_fire])
     
     self.np_a_young_girl_with_red_hair_and_glasses_is_sitting  = Clause(self.np_a_young_girl_with_red_hair_and_glasses, self.vp_is_sitting)
     
     
     self.np_a_young_girl_with_red_hair_and_glasses_is_sitting_by_the_fire  = Clause(self.np_a_young_girl_with_red_hair_and_glasses, self.vp_is_sitting_by_the_fire)