/
populateIntents.py
27 lines (26 loc) · 997 Bytes
/
populateIntents.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import writeToJson
import directory
import json
def updateIntentDept():
dept_list = directory.get_all_dept_names()
for dept in dept_list:
response = directory.get_deptInfo_by_name(dept)
new_data = {
"tag": dept,
"patterns": [
"How do I get to the department of "+ dept,
"where is the building of "+dept,
"have any idea where the location of "+dept+" is?",
"where do i find the "+dept+" building"
],
"responses": [
response
],
"context_set": ""
}
# data = json.loads(new_data)
# data['responses'] = data['responses'].replace("\\n","\n")
# new_data = json.dumps(data)
print (new_data)
writeToJson.write_json(new_data)
# updateIntentDept()