This repository has been archived by the owner on Oct 3, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
init-skills.js
86 lines (84 loc) · 1.74 KB
/
init-skills.js
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//add user
let ara = db.getSiblingDB('ara')
ara.createUser(
{
user:'ara',
pwd:'thepassword',
roles:[
{
role:'readWrite',
db:'ara'
}
]
}
);
//add search data
let data = [
{
"url": "SELFv1/skills/weather",
"data":{
"word": "weather",
"type": {
"dep": "nsubj",
"pos": "NOUN",
"tag": "*",
"lemma": "weather"
}
}
},
{
"url": "SELFv1/skills/timer",
"data":{
"word": "timer",
"type": {
"dep": "dobj",
"pos": "NOUN",
"tag": "*",
"lemma": "timer"
}
}
},
{
"url": "SELFv1/skills/call",
"data":{
"word": "call",
"type": {
"dep": "ROOT",
"pos": "VERB",
"tag": "VB",
"lemma": "call"
}
}
},
{
"url": "SELFv1/skills/text",
"data":{
"word": "text",
"type": {
"dep": "ROOT",
"pos": "NOUN",
"tag": "NN",
"lemma": "text"
}
}
},
{
"url": "",
"data":{
"word": "text",
"type": {
"dep": "compound",
"pos": "NOUN",
"tag": "NNS",
"lemma": "text"
}
}
}
]
for (i of data){
let toInsert = {
"_id": Math.round(Math.random() * 10000000).toString(),
"document": i
}
ara.search.insertOne(toInsert)
}