Пример #1
0
    def test_parse(self):
        # Given / When
        train(BEVERAGE_DATASET_PATH, str(self.tmp_file_path), config_path=None)

        # When
        with self.fail_if_exception("Failed to parse using CLI script"):
            parse(str(self.tmp_file_path), "Make me two cups of coffee")
Пример #2
0
    def test_train(self):
        # Given / When
        train(BEVERAGE_DATASET_PATH, str(self.tmp_file_path), config_path=None)

        # Then
        if not self.tmp_file_path.exists():
            self.fail("No trained engine generated")
        msg = "Failed to create an engine from engine dict."
        with self.fail_if_exception(msg):
            SnipsNLUEngine.from_path(self.tmp_file_path)
Пример #3
0
    def test_train(self):
        # Given / When
        train(BEVERAGE_DATASET_PATH, str(self.tmp_file_path), config_path=None)

        # Then
        if not self.tmp_file_path.exists():
            self.fail("No trained engine generated")
        msg = "Failed to create an engine from engine dict."
        with self.fail_if_exception(msg):
            with self.tmp_file_path.open(mode="r", encoding="utf8") as f:
                trained_engine_dict = json.load(f)
            SnipsNLUEngine.from_dict(trained_engine_dict)
Пример #4
0
    def test_train(self):
        # Given / When
        train(self.beverage_dataset_path,
              str(self.tmp_file_path),
              config_path=None,
              verbose=False)

        # Then
        if not self.tmp_file_path.exists():
            self.fail("No trained engine generated")
        msg = "Failed to create an engine from engine dict."
        with self.fail_if_exception(msg):
            SnipsNLUEngine.from_path(self.tmp_file_path)