Пример #1
0
    def setUp(self):
        self.tmpfolder = "tests/resources/highlight_temp_folder/"
        self.tmpbatchfolder = "tests/resources/highlight_temp_folder/batch"
        self.input_file = "tests/resources/test_workspaces/customer_care_skill_test.tsv"
        self.lang_util = lang_utils.LanguageUtility("en")
        unittest.TestCase.setUp(self)
        with open(CONFIG_FILE) as fi:
            self.apikey = fi.readline().strip()
            self.wksp_id = fi.readline().strip()

        self.conversation = skills_util.retrieve_conversation(
            iam_apikey=self.apikey)

        if not os.path.exists(self.tmpfolder):
            os.makedirs(self.tmpfolder)
            os.makedirs(self.tmpbatchfolder)

        test_df = skills_util.process_test_set(self.input_file, self.lang_util)
        self.results = inferencer.inference(
            self.conversation,
            self.wksp_id,
            test_df,
            max_retries=20,
            max_thread=THREAD_NUM,
            verbose=False,
        )
 def setUp(self):
     self.lang_util = lang_utils.LanguageUtility("en")
     with open(
             "tests/resources/test_workspaces/skill-Customer-Care-Sample.json",
             "r") as skill_file:
         workspace_data, workspace_vocabulary = skills_util.extract_workspace_data(
             json.load(skill_file), self.lang_util)
         self.workspace_df = pd.DataFrame(workspace_data)
 def setUp(self):
     unittest.TestCase.setUp(self)
     self.lang_util = lang_utils.LanguageUtility("en")
     test_skill_file = (
         "tests/resources/test_workspaces/skill-Customer-Care-Sample.json")
     with open(test_skill_file, "r") as skill_file:
         workspace_data, workspace_vocabulary = skills_util.extract_workspace_data(
             json.load(skill_file), self.lang_util)
         self.workspace_df = pd.DataFrame(workspace_data)
         self.test_data = pd.DataFrame({
             "utterance": [
                 "Boston is the capital city of massachusetts ",
                 "Boston Celtics is a famous NBA team",
                 "new york is a big city in the east coast",
             ],
             "intent": ["boston", "boston", "nyc"],
         })
    def setUp(self):
        unittest.TestCase.setUp(self)
        self.lang_util = lang_utils.LanguageUtility("en")
        with open(
                "tests/resources/test_workspaces/skill-Customer-Care-Sample.json",
                "r") as skill_file:
            workspace_data, workspace_vocabulary = skills_util.extract_workspace_data(
                json.load(skill_file), self.lang_util)

            self.workspace_df = pd.DataFrame(workspace_data)
            self.train_set_pd = pd.DataFrame({
                "utterance": ["boston is close to new york"],
                "intent": ["Boston_New_York"],
                "tokens": [["boston", "is", "close", "to", "new", "york"]],
            })
            self.test_set_pd = pd.DataFrame({
                "utterance": [
                    "both boston and new york are on east coast",
                    "boston is close to new york",
                ],
                "intent": ["Boston_New_York", "Boston_New_York"],
                "tokens": [
                    [
                        "both",
                        "boston",
                        "and",
                        "new",
                        "york",
                        "are",
                        "on",
                        "east",
                        "coast",
                    ],
                    ["boston", "is", "close", "to", "new", "york"],
                ],
            })
Пример #5
0
 def setUp(self):
     unittest.TestCase.setUp(self)
     self.skill_file = open(
         "tests/resources/test_workspaces/skill-Customer-Care-Sample.json",
         "r")
     self.lang_util = lang_utils.LanguageUtility("en")