示例#1
0
 def test_correct_stat_classification(self):
     query = "What is Kobe Bryant's shooting percentage??"
     handler = InferenceNetwork(query)
     node_type = handler.node_type
     response = handler.response()
     self.assertEqual(node_type, "stat")
     self.assertNotIn(response, {non_nba, unsure})
示例#2
0
 def test_correct_rank_classification(self):
     query = "Who is a better shooter Kobe Bryant or Lebron James?"
     handler = InferenceNetwork(query)
     node_type = handler.node_type
     response = handler.response()
     self.assertEqual(node_type, "rank")
     self.assertNotIn(response, {non_nba, unsure})
示例#3
0
 def test_wrong_stat_classification(self):
     query = "is this a shot?"
     handler = InferenceNetwork(query)
     node_type = handler.node_type
     response = handler.response()
     self.assertEqual(
         node_type,
         "stat")  # Making sure it gets wrongly classified as stat
     self.assertIn(response, {non_nba, unsure})
示例#4
0
 def test_wrong_rank_classification(self):
     query = "Who is a better singer Beyonce or me in the shower?"
     handler = InferenceNetwork(query)
     node_type = handler.node_type
     response = handler.response()
     self.assertEqual(
         node_type,
         "rank")  # Making sure it gets wrongly classified as rank
     self.assertIn(response, {non_nba, unsure})
示例#5
0
 def test_wrong_rank_classification(self):
     query = "lebron james"
     handler = InferenceNetwork(query)
     node_type = handler.node_type
     response = handler.response()
     self.assertEqual(
         node_type,
         "rank")  # Making sure it gets wrongly classified as rank
     self.assertIn(response, {non_nba, unsure})
示例#6
0
 def process(self):
     flag = isNBA(self.text)
     if flag == -1:
         return non_nba
     elif flag == 0:
         return unsure
     else:
         network = InferenceNetwork(self.text)
         return network.response()
示例#7
0
 def process(self):
     network = InferenceNetwork(self.text)
     return network.response()