Пример #1
0
 def test_7_y_n_question(self):
     logger.info("\n*************  test_7_y_n_question verb to be ******************")
     logger.info("Is my cube on the table1?")
     sentence = Sentence(YES_NO_QUESTION, "",
                         [NominalGroup(['my'],
                                        ['cube'],
                             [],
                             [],
                             [])],
                         [VerbalGroup(['be'],
                             [],
                                       'present simple',
                             [],
                                       [IndirectComplement(['on'],
                                                            [NominalGroup(['the'],
                                                                           ['table1'],
                                                                [],
                                                                [],
                                                                [])])],
                             [],
                             [],
                                       VerbalGroup.affirmative,
                             [])])
     expected_result = False
     self.process(sentence, expected_result)
Пример #2
0
 def test_1_where_question(self):
     logger.info("\n*************  test_1_where_question ******************")
     logger.info("Where is the blue cube?")
     sentence = Sentence(W_QUESTION, "place",
                         [NominalGroup(['the'],
                                        ['cube'],
                                        [['blue', []]],
                             [],
                             [])],
                         [VerbalGroup(['be'],
                             [],
                                       'present_simple',
                             [],
                             [],
                             [],
                             [],
                                       VerbalGroup.affirmative,
                             [])])
     expected_result = 'table1'
     self.process(sentence, expected_result)
Пример #3
0
 def test_9_how_question(self):
     logger.info("\n*************  test_9_how_question ******************")
     logger.info("How is my car?")
     sentence = Sentence(W_QUESTION, "manner",
                         [NominalGroup(['my'],
                                        ['cube'],
                             [],
                             [],
                             [])],
                         [VerbalGroup(['be'],
                             [],
                                       'present simple',
                             [],
                             [],
                             [],
                             [],
                                       VerbalGroup.affirmative,
                             [])])
     expected_result = [['blue', []]]
     self.process(sentence, expected_result)
Пример #4
0
 def test_13_who_question(self):
     logger.info("\n*************  test_13_who_question ******************")
     logger.info("who is the SPEAKER?")
     sentence = Sentence(W_QUESTION, "people",
                         [NominalGroup(['the'],
                                        ['SPEAKER'],
                             [],
                             [],
                             [])],
                         [VerbalGroup(['be'],
                             [],
                                       'present simple',
                             [],
                             [],
                             [],
                             [],
                                       VerbalGroup.affirmative,
                             [])])
     expected_result = 'SPEAKER'
     self.process(sentence, expected_result)
Пример #5
0
 def test_12_what_question(self):
     logger.info("\n*************  test_12_what_question ******************")
     logger.info("what color is the blue_cube?")
     sentence = Sentence(W_QUESTION, "color",
                         [NominalGroup(['the'],
                                        ['blue_cube'],
                             [],
                             [],
                             [])],
                         [VerbalGroup(['be'],
                             [],
                                       'present simple',
                             [],
                             [],
                             [],
                             [],
                                       VerbalGroup.affirmative,
                             [])])
     expected_result = 'blue'
     self.process(sentence, expected_result)
Пример #6
0
 def test_11_what_question(self):
     logger.info("\n*************  test_11_w_question ******************")
     logger.info("what size is this?")
     sentence = Sentence(W_QUESTION, "size",
                         [NominalGroup(['this'],
                             [],
                             [],
                             [],
                             [])],
                         [VerbalGroup(['be'],
                             [],
                                       'present simple',
                             [],
                             [],
                             [],
                             [],
                                       VerbalGroup.affirmative,
                             [])])
     expected_result = 'small'
     self.process(sentence, expected_result)
Пример #7
0
 def test_10_what_question(self):
     logger.info("\n*************  test_10_w_question ******************")
     logger.info("what object is blue?")
     sentence = Sentence(W_QUESTION, "object",
         [],
                         [VerbalGroup(['be'],
                             [],
                                       'present simple',
                                       [NominalGroup([],
                                           [],
                                           [['blue', []]],
                                           [],
                                           [])],
                             [],
                             [],
                             [],
                                       VerbalGroup.affirmative,
                             [])])
     expected_result = 'blue_cube'
     self.process(sentence, expected_result)
Пример #8
0
 def test_9_what_question_this(self):
     logger.info("\n*************  test_9_what_question_this ******************")
     logger.info("what is this?")
     sentence = Sentence(W_QUESTION, "thing",
                         [NominalGroup(['this'],
                             [],
                             [],
                             [],
                             [])],
                         [VerbalGroup(['be'],
                             [],
                                       'present simple',
                             [],
                             [],
                             [],
                             [],
                                       VerbalGroup.affirmative,
                             [])])
     expected_result = 'another_cube'
     self.process(sentence, expected_result)
Пример #9
0
    def test_14_who_question(self):
        logger.info("\n*************  test_14_who_question ******************")
        logger.info("who sees Patrick?")
        sentence = Sentence(W_QUESTION, "people",
            [],
                            [VerbalGroup(['see'],
                                [],
                                          'present simple',
                                          [NominalGroup([],
                                              ['Patrick'],
                                              [],
                                              [],
                                              [])],
                                [],
                                [],
                                [],
                                          VerbalGroup.affirmative,
                                [])])
        expected_result = 'id_danny'

        self.process(sentence, expected_result)
Пример #10
0
    def test_3_what_question(self):
        logger.info("\n*************  test_3_what_question ******************")
        logger.info("What do you see?")
        sentence = Sentence(W_QUESTION, "thing",
                            [NominalGroup([],
                                ['you'],
                                [],
                                [],
                                [])],
                            [VerbalGroup(['see'],
                                [],
                                          'present_simple',
                                [],
                                [],
                                [],
                                [],
                                          VerbalGroup.affirmative,
                                [])])
        expected_result = 'shelf1'

        self.process(sentence, expected_result)
Пример #11
0
 def test_6_y_n_question(self):
     logger.info("\n*************  test_6_y_n_question ******************")
     logger.info("Is the small cube blue?")
     sentence = Sentence(YES_NO_QUESTION, "",
                         [NominalGroup(['the'],
                                        ['cube'],
                                        [['small', []]],
                             [],
                             [])],
                         [VerbalGroup(['be'],
                             [],
                                       'present simple',
                                       [NominalGroup([],
                                           [],
                                           [['blue', []]],
                                           [],
                                           [])],
                             [],
                             [],
                             [],
                                       VerbalGroup.affirmative,
                             [])])
     expected_result = False
     self.process(sentence, expected_result)
Пример #12
0
 def test_4_y_n_question(self):
     logger.info("\n*************  test_4_y_n_question action verb******************")
     logger.info("Did you get the blue cube?")
     sentence = Sentence(YES_NO_QUESTION, "",
                         [NominalGroup([],
                             ['you'],
                             [''],
                             [],
                             [])],
                         [VerbalGroup(['get'],
                             [],
                                       'past simple',
                                       [NominalGroup(['the'],
                                                      ['cube'],
                                                      [['blue', []]],
                                           [],
                                           [])],
                             [],
                             [],
                             [],
                                       VerbalGroup.affirmative,
                             [])])
     expected_result = True
     self.process(sentence, expected_result)
Пример #13
0
 def test_15_who_question(self):
     logger.info("\n*************  test_15_who_question ******************")
     logger.info("who does Danny give the small cube?")
     sentence = Sentence(W_QUESTION, "people",
                         [NominalGroup([],
                             ['Danny'],
                             [],
                             [],
                             [])],
                         [VerbalGroup(['give'],
                             [],
                                       'present simple',
                                       [NominalGroup(['the'],
                                                      ['cube'],
                                                      [['small', []]],
                                           [],
                                           [])],
                             [],
                             [],
                             [],
                                       VerbalGroup.affirmative,
                             [])])
     expected_result = 'SPEAKER'
     self.process(sentence, expected_result)