Skip to content

Instantly share code, notes, and snippets.

@MatthewScholefield
Created June 28, 2018 20:29
Show Gist options
  • Save MatthewScholefield/611b0dd9cdff82e135fb4e855d77e826 to your computer and use it in GitHub Desktop.
Save MatthewScholefield/611b0dd9cdff82e135fb4e855d77e826 to your computer and use it in GitHub Desktop.
Convert padatious intent lines to rasa training data json
from typing import Dict
def create_rasa_training_data(intent_lines: Dict[str, list]) -> Dict:
return {
'rasa_nlu_data': {
'common_examples': sum([
[
{
"text": line,
"intent": intent,
"entities": []
}
for line in lines
]
for intent, lines in intent_lines.items()
], [])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment