Watson is in the form
Question, Intent
Can I buy a sandwich?, #buy_sandwich
RASA in the form
## intent:buy_sandwich
- Can I buy a sandwich?
This is yml format but RASA calls it .md. The code for this conversion from Watson format to RASA is below
import pandas as pd
questions = pd.read_excel(filePath,names=['Intent','Question'])
file = open("rasaoutput.md","w", encoding="utf-8")
for x in labels:
#print the intention name in rasa way
file.write("## intent:"+x+"\n")
#then print every question in the dataset with that label
y=questions[questions['Intent'].str.contains(x)]['Question']
#change series into an array
z=y.values
i = 0
while i < len(z):
file.write(str("- "+z[i]+"\n"))
i=i+1
-David
No comments:
Post a Comment