Showing
4 changed files
with
29 additions
and
14 deletions
... | @@ -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,9 +7,24 @@ const apiRequest = require('./apiRequest'); | ... | @@ -7,9 +7,24 @@ 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 = []; |
13 | 28 | ||
14 | for( let i = 0; i <= searchResults.length; i += keyNum ) { | 29 | for( let i = 0; i <= searchResults.length; i += keyNum ) { |
15 | divideSearchResults.push( searchResults.slice( i, i + keyNum ) ); | 30 | divideSearchResults.push( searchResults.slice( i, i + keyNum ) ); |
... | @@ -24,7 +39,7 @@ const machineRead = async ( searchResults, keywordText ) => { | ... | @@ -24,7 +39,7 @@ const machineRead = async ( searchResults, keywordText ) => { |
24 | } | 39 | } |
25 | ResultArray = ResultArray.concat( divideSearchResult ); | 40 | ResultArray = ResultArray.concat( divideSearchResult ); |
26 | } | 41 | } |
27 | - | 42 | + |
28 | searchResults = ResultArray; | 43 | searchResults = ResultArray; |
29 | return searchResults; | 44 | return searchResults; |
30 | } | 45 | } | ... | ... |
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(); | ... | ... |
-
Please register or login to post a comment