async def convert_and_write(cls, source_path: Path, output_path: Path) -> None: """Converts the given training data file and saves it to the output directory. Args: source_path: Path to the training data file. output_path: Path to the output directory. """ reader = NLGMarkdownReader() writer = RasaYAMLWriter() output_nlg_path = cls.generate_path_for_converted_training_data_file( source_path, output_path ) training_data = reader.read(source_path) converted_responses = {} for response_name, examples in training_data.responses.items(): new_response_name = cls._normalize_response_name(response_name) converted_responses[new_response_name] = examples converted_training_data = TrainingData(responses=converted_responses) writer.dump(output_nlg_path, converted_training_data) print_success(f"Converted NLG file: '{source_path}' >> '{output_nlg_path}'.")
def convert_and_write(cls, source_path: Path, output_path: Path) -> None: """Converts the given training data file and saves it to the output directory. Args: source_path: Path to the training data file. output_path: Path to the output directory. """ reader = NLGMarkdownReader() writer = RasaYAMLWriter() output_nlg_path = cls.generate_path_for_converted_training_data_file( source_path, output_path) yaml_training_data = reader.read(source_path) writer.dump(output_nlg_path, yaml_training_data) print_success( f"Converted NLG file: '{source_path}' >> '{output_nlg_path}'.")