def read_inputs_md(input_path): reader = MarkdownReader() reader.read(input_path, language='de', fformat='MARKDOWN') texts = [] cats = [] for message in reader.training_examples: texts.append(message.text) cats.append(message.get('intent')) return texts, cats
def _write_nlu_yaml(training_data_path: Path, output_path: Path, source_path: Path) -> None: reader = MarkdownReader() writer = RasaYAMLWriter() training_data = reader.read(training_data_path) writer.dump(output_path, training_data) print_success(f"Converted NLU file: '{source_path}' >> '{output_path}'.")
from rasa.nlu.training_data.formats import MarkdownReader import xlsxwriter workbook = xlsxwriter.Workbook('filename.xlsx') worksheet = workbook.add_worksheet() worksheet.write('A1', 'question') worksheet.write('B1', 'label') worksheet.write('C1', 'answer') training_data = () row = 1 col = 0 doc = "PATH\\TO\\nlu.md" reader = MarkdownReader() reader.read(doc, language='de', fformat='MARKDOWN') for message in reader.training_examples: training_data = training_data + ([message.text, message.get('intent')], ) for question, label in (training_data): worksheet.write_string(row, col, question) worksheet.write_string(row, col + 1, label) worksheet.write_string(row, col + 2, '') row += 1 workbook.close()