Skip to content

Instantly share code, notes, and snippets.

@ourway
Forked from nmstoker/convert.py
Last active July 25, 2020 01:26
Show Gist options
  • Save ourway/335cac50a424ddd3cbc68692d4b3b2ac to your computer and use it in GitHub Desktop.
Save ourway/335cac50a424ddd3cbc68692d4b3b2ac to your computer and use it in GitHub Desktop.
Convert a Rasa NLU training file from JSON to Markdown format
from rasa_nlu.training_data import load_data
# This re-uses the Rasa NLU converters code to turn a JSON Rasa NLU training
# file into MD format and save it
# Assumes you have Rasa NLU installed :-)
# If you want other options, look at the NLU code to work out how to handle them
# USE AT YOUR OWN RISK
input_training_file = '/home/username/Projects/your-project/data/training.json'
# *******************************************************
# TAKE CARE: output_md_file is overwritten automatically
# *******************************************************
output_md_file = '/home/username/Projects/your-project/data/training.md'
with open(output_md_file,'w') as f:
f.write(load_data(input_training_file).as_markdown())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment