bluejoyq

edit backend server for machine read

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