示例#1
0
 def test_chunk_important_date_registration(self):
     utterance = "When is registration?"
     expected_result = ("REGISTRATION", "registration")
     doc = chunk_important_date(utterance, important_date_dir="../important_date/")
     for ent in doc.ents:
         result = (ent.label_, ent.text)
     self.assertEqual(expected_result, result)
示例#2
0
 def test_chunk_important_date_break(self):
     utterance = "When is the break?"
     expected_result = ("BREAK", "break")
     doc = chunk_important_date(utterance, important_date_dir="../important_date/")
     for ent in doc.ents:
         result = (ent.label_, ent.text)
     self.assertEqual(expected_result, result)
示例#3
0
 def test_chunk_important_date_finals(self):
     utterance = "When are finals?"
     expected_result = ("FINALS", "finals")
     doc = chunk_important_date(utterance, important_date_dir="../important_date/")
     for ent in doc.ents:
         result = (ent.label_, ent.text)
     self.assertEqual(expected_result, result)
示例#4
0
 def test_chunk_important_date_semester_end(self):
     utterance = "When does the semester end?"
     expected_result = ("SEMESTER_END", "semester end")
     doc = chunk_important_date(utterance, important_date_dir="../important_date/")
     for ent in doc.ents:
         result = (ent.label_, ent.text)
     self.assertEqual(expected_result, result)
示例#5
0
 def test_chunk_important_date_faculty_report(self):
     utterance = "When does faculty report?"
     expected_result = ("FACULTY_REPORT", "faculty report")
     doc = chunk_important_date(utterance, important_date_dir="../important_date/")
     for ent in doc.ents:
         result = (ent.label_, ent.text)
     self.assertEqual(expected_result, result)
示例#6
0
 def test_chunk_important_date_drop_date(self):
     utterance = "When is the last day to drop a class?"
     expected_result = ("DROP_DATE", "drop a class")
     doc = chunk_important_date(utterance, important_date_dir="../important_date/")
     for ent in doc.ents:
         result = (ent.label_, ent.text)
     self.assertEqual(expected_result, result)
示例#7
0
 def test_chunk_important_date_withdraw_date(self):
     utterance = "When is the last day to withdraw from a class?"
     expected_result = ("WITHDRAW_DATE", "day to withdraw from a class")
     doc = chunk_important_date(utterance, important_date_dir="../important_date/")
     for ent in doc.ents:
         result = (ent.label_, ent.text)
     self.assertEqual(expected_result, result)
示例#8
0
 def test_chunk_important_date_open_residence_halls(self):
     utterance = "When do the residence halls open?"
     expected_result = ("OPEN_RESIDENCE_HALLS", "residence halls")
     doc = chunk_important_date(utterance, important_date_dir="../important_date/")
     for ent in doc.ents:
         result = (ent.label_, ent.text)
     self.assertEqual(expected_result, result)
示例#9
0
 def test_chunk_important_date_curriculum_study(self):
     utterance = "When is curriculum study?"
     expected_result = ("CURRICULUM_STUDY", "curriculum study")
     doc = chunk_important_date(utterance, important_date_dir="../important_date/")
     for ent in doc.ents:
         result = (ent.label_, ent.text)
     self.assertEqual(expected_result, result)
    def chunk_utterance(self, intent, utterance):
        """ chunk_utterance finds variable slots """
        print("In chunk utterance")
        print("Utterance: ", utterance, "\tIntent: ", intent)
        if intent == "important_date":
            print("in important date chunk")
            doc = chunk_important_date(utterance)
            # print("Entities in '%s'" % utterance)
            # for ent in doc.ents:
            #    print(ent.label_, ent.text)
        elif intent == "course":
            print("in course chunk")
            doc = chunk_course(utterance)
        elif intent == "professor":
            print("professor chunk")
            doc = chunk_professor_name(utterance)
        elif intent == "location":
            doc = None
            print("location chunk")
        else:
            doc = None
            print("intent didn't match")

        return doc