bluejoyq

edit backend server for machine read

......@@ -93,16 +93,16 @@ apiRequest.multiETRI = async ( searchResults, keywordText ) => {
/**
* @param {String} keywordText 사용자의 검색에서 textAnalystic을 거쳐 keyword만 남은 text
* @param {{title:string,passage:string,ulr:string}} searchResult searchResults keywordtext문장을 검색하여 나온 결과들
* @param {{title:string,passage:string,url:string}} searchResult searchResults keywordtext문장을 검색하여 나온 결과들
* @returns confidence key와 해당 value가 추가된 searchResults
* @description DOCVECAPI를 이용해 각각의 searchResult의 keywordtext에 대한 정확도(confidence, 검색문장에 대해 검색 결과가 얼마나 지)를
* 판단하고, confidence key와 해당 value를 searchResult에 추가해줍니다.
*/
const DOCVECAPI = (searchResults, keywordText, index) => {
apiRequest.DOCVECAPI = (searchResults, keywordText, index) => {
return new Promise((resolve, reject) => {
apiReqOption = {
method: "POST",
uri: "http://15.164.215.24:5000/analyze",
uri: "http://"+process.env.URL+"/analyze",
body: {
sentence1: searchResults[index].passage,
sentence2: keywordText
......
......@@ -7,9 +7,24 @@ const apiRequest = require('./apiRequest');
* @description 기계독해를 사용하는 함수
*/
const machineRead = async ( searchResults, keywordText ) => {
for(let i = 0; i < searchResults.length; i++)
{
try {
await apiRequest.DOCVECAPI(searchResults,keywordText,i);
}
catch ( err ) {
throw new Error( err.message );
}
}
return searchResults;
}
const oldMachineRead = async (searchResults,keywordText)=>{
let keyNum = 6,
ResultArray = [],
divideSearchResults = [];
ResultArray = [],
divideSearchResults = [];
for( let i = 0; i <= searchResults.length; i += keyNum ) {
divideSearchResults.push( searchResults.slice( i, i + keyNum ) );
......@@ -24,7 +39,7 @@ const machineRead = async ( searchResults, keywordText ) => {
}
ResultArray = ResultArray.concat( divideSearchResult );
}
searchResults = ResultArray;
return searchResults;
}
......
{
"devToolsPort": 19002,
"expoServerPort": null,
"packagerPort": null,
"packagerPid": null,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null
"expoServerPort": 19000,
"packagerPort": 19001,
"packagerPid": 24100,
"expoServerNgrokUrl": "https://ru-c66.bluejoy.searchguide.exp.direct",
"packagerNgrokUrl": "https://packager.ru-c66.bluejoy.searchguide.exp.direct",
"ngrokPid": 25536
}
......
......@@ -23,8 +23,8 @@ export const load = () => async (dispatch) =>{
export const submit = (text) => async (dispatch) => {
dispatch( {type:START});
try{
const response = await readTest()
//const response = await sendSearch(text.nativeEvent.text);
//const response = await readTest()
const response = await sendSearch(text.nativeEvent.text);
let tempScore = scoring(response.return_data);
await sqlite.insert(tempScore.full);
let past = await sqlite.select();
......