Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
with open('intents.json') as file:
data = json.load(file)
training_sentences = []
training_labels = []
labels = []
responses = []
for intent in data['intents']:
for pattern in intent['patterns']:
training_sentences.append(pattern)
training_labels.append(intent['tag'])
responses.append(intent['responses'])
if intent['tag'] not in labels:
labels.append(intent['tag'])
num_classes = len(labels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment