def __init__( self, config_file: Text, domain_path: Optional[Text] = None, training_data_paths: Optional[Union[List[Text], Text]] = None, project_directory: Optional[Text] = None, ): self.config = io_utils.read_config_file(config_file) if domain_path: self._domain_paths = [domain_path] else: self._domain_paths = [] self._story_paths = [] self._e2e_story_paths = [] self._nlu_paths = [] self._imports = [] self._additional_paths = training_data_paths or [] self._project_directory = project_directory or os.path.dirname(config_file) self._init_from_dict(self.config, self._project_directory) extra_nlu_files = data.get_data_files(training_data_paths, data.is_nlu_file) extra_story_files = data.get_data_files(training_data_paths, data.is_story_file) self._story_paths += extra_story_files self._nlu_paths += extra_nlu_files logger.debug( "Selected projects: {}".format("".join([f"\n-{i}" for i in self._imports])) ) mark_as_experimental_feature(feature_name="MultiProjectImporter")
def test_get_core_nlu_files(project): data_dir = os.path.join(project, "data") nlu_files = data.get_data_files([data_dir], data.is_nlu_file) core_files = data.get_data_files([data_dir], data.is_story_file) assert len(nlu_files) == 1 assert list(nlu_files)[0].endswith("nlu.yml") assert len(core_files) == 2 assert any(file.endswith("stories.yml") for file in core_files) assert any(file.endswith("rules.yml") for file in core_files)
def __init__( self, config_file: Optional[Text] = None, domain_path: Optional[Text] = None, training_data_paths: Optional[Union[List[Text], Text]] = None, ): self._domain_path = domain_path self._nlu_files = data.get_data_files(training_data_paths, data.is_nlu_file) self._story_files = data.get_data_files(training_data_paths, data.is_story_file) self.config = autoconfig.get_configuration(config_file)
def test_get_story_file_with_yaml(): examples_dir = "data/test_yaml_stories" core_files = data.get_data_files([examples_dir], data.is_story_file) assert core_files
def test_find_nlu_files_with_different_formats(test_input, expected): examples_dir = "data/examples" data_dir = os.path.join(examples_dir, test_input) nlu_files = data.get_data_files([data_dir], data.is_nlu_file) assert [Path(f) for f in nlu_files] == [Path(f) for f in expected]
async def test_get_files_with_mixed_training_data(): default_data_path = "data/test_mixed_yaml_training_data/training_data.yml" assert data.get_data_files(default_data_path, data.is_nlu_file) assert data.get_data_files(default_data_path, data.is_story_file)