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})
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})
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})
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})
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})
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()
def process(self): network = InferenceNetwork(self.text) return network.response()