김서영

add machine read model

......@@ -75,4 +75,30 @@ apiRequest.Korean = async ( text ) => {
});
}
const DOCVECAPI = (searchResults, keywordText, index) => {
return new Promise((resolve, reject) => {
apiReqOption = {
method: "POST",
uri: "http://127.0.0.1:5000/analyze",
body: {
sentence1: searchResults[index].passage,
sentence2: keywordText
},
json: true
};
rp.post(apiReqOption)
.then(body => {
if (body.result == "-1") {
throw new Error(body.data + " index : " + index);
}
searchResults[index].confidence = Number(body.result);
resolve();
})
.catch(err => {
searchResults[index].confidence = 0;
resolve();
});
});
};
module.exports = apiRequest;
......