-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathidea.txt
101 lines (72 loc) · 3.17 KB
/
idea.txt
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
hide price, and take out profanity, no referencing competitors
-> amazon, walmart,staples, thesource, ncix,
chat bot
i'm going to ask which product the user wants to know user reviews on
then im going to use bestbuy api to give me the product id
then i'll use that product id to query the the user review msgs
then i'll compare these msgs with my luis models
right now
a user types something, and depending on what they say, it links to a function that does something
i want to compare the msgs in the reviews, and save which ever keywords generate more matches.
i need to send in the reviews as my own msgs and compare them to luis.
dialog.matches('analyze-keywords', (session, result) => {
if(result.entities && result.entities[0]) {
var product = result.entities[0].entity;
superagent
.get('https://msi.bbycastatic.ca/mobile-si/si/v3/products/search')
.query({query: product})
.end((err, res) => {
var products = res.body.searchApi.documents.slice(0, 3);
var msg = new builder.Message(session).text("Here are a few things you might like...");
products.map(p => msg.addAttachment(createHeroCard(session, p)));
session.send(msg);
});
var haveProduct = use bestbuy api to grab productId
if(haveProduct){
var reviews = use bestbuy api to grab product reviews
var i;
for(i = 0; i < reviews.length; i++){
iterate through all the reviews and send each review to text analysis API and return top keywords
var keywordsOfReview = reviews[0]...
}
} else {
session.send('This product does not exist in our database!');
}
} else {
session.send('Please specify a product');
}
});
// pre
dialog.matches('analyze-keywords', (session, result) => {
if(result.entities && result.entities[0]) {
var product = result.entities[0].entity;
superagent
.get('https://msi.bbycastatic.ca/mobile-si/si/v3/products/search')
.query({query: product})
.end((err, res) => {
var products = res.body.searchApi.documents.slice(0, 3);
var msg = new builder.Message(session).text("Here are a few things you might like...");
products.map(p => msg.addAttachment(createHeroCard(session, p)));
session.send(msg);
session.userData.product = products[0];
});
var sku;
var reviews = use bestbuy api to grab product reviews
superagent
.get('https://msi.bbycastatic.ca/mobile-si/si/v4/pdp/overview/{productID}')
.query({query: product})
.end((err, res) => {
var products = res.body.searchApi.documents.slice(0, 3);
var msg = new builder.Message(session).text("Here are a few things you might like...");
products.map(p => msg.addAttachment(createHeroCard(session, p)));
session.send(msg);
});
var i;
for(i = 0; i < reviews.length; i++){
iterate through all the reviews and send each review to text analysis API and return top keywords
var keywordsOfReview = reviews[0]...
} else {
session.send('Please specify a product');
}
}
});