예제 #1
0
 def test_checkingTwoWordedStates(self):
     self.assertEqual(
         location_info.extract_location("Washington DC 20022")["Zipcode"], "20022"
     )
     self.assertEqual(
         location_info.extract_location("Princeton New Jersey 08540")["Zipcode"],
         "08540",
     )
예제 #2
0
    def run(self, request, *, outer_task_id):
        """
        returns dictionary with transcription text and keys relating to extracted date
        and location info.
        all key values (except transcription text) are None if extraction fails
        """

        text = request.get("text")
        call_sid = request.get("call_sid")

        logger.info(f"Extract got text = {text}.")
        self.update_state(task_id=outer_task_id, state=State.extracting)

        d = {"trancription": text}

        date = date_info.extract_date_time(text)
        d.update(date)

        location = location_info.extract_location(text)
        d.update(location)

        logger.info(f"Date = {date}. Location = {location}")
        self.update_state(task_id=outer_task_id, state=State.extracting_done)

        return {"call_sid": call_sid, "data": d}
예제 #3
0
 def test_findsInFullSentence(self):
     self.assertEqual(
         location_info.extract_location(
             "something something happened in Washington 98102"
         )["Zipcode"],
         "98102",
     )
예제 #4
0
 def test_basic(self):
     self.assertEqual(
         location_info.extract_location("Washington 98102"),
         {
             "State": "WA",
             "Zipcode": "98102",
             "City": "Seattle",
             "Confidence_location": "high",
         },
     )
예제 #5
0
 def test_isNotNone(self):
     self.assertIsNotNone(location_info.extract_location("Washington 98102"))
예제 #6
0
 def test_lowConfindenceIfNonMatchingZip(self):
     results_dict = location_info.extract_location("texas 10983")
     self.assertEqual(results_dict["Confidence_location"], "low")
     self.assertEqual(results_dict["State"], "TX")
예제 #7
0
 def test_checkCapitalization2(self):
     self.assertEqual(
         location_info.extract_location("WASHINGTON 98102")["Zipcode"], "98102"
     )
예제 #8
0
 def test_checkCapitalization(self):
     self.assertEqual(
         location_info.extract_location("washington 98102")["Zipcode"], "98102"
     )