Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김서영
/
searchGuide
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
bluejoyq
2019-12-05 18:53:32 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
024bbea0a42de5a799334ff487b148ac896666ff
024bbea0
1 parent
3204b228
edit backend server for machine read
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
14 deletions
api/apiRequest.js
api/machineRead.js
searchGuide/.expo/packager-info.json
searchGuide/reducers/search.js
api/apiRequest.js
View file @
024bbea
...
...
@@ -93,16 +93,16 @@ apiRequest.multiETRI = async ( searchResults, keywordText ) => {
/**
* @param {String} keywordText 사용자의 검색에서 textAnalystic을 거쳐 keyword만 남은 text
* @param {{title:string,passage:string,u
lr
:string}} searchResult searchResults keywordtext문장을 검색하여 나온 결과들
* @param {{title:string,passage:string,u
rl
: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
...
...
api/machineRead.js
View file @
024bbea
...
...
@@ -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
;
}
...
...
searchGuide/.expo/packager-info.json
View file @
024bbea
{
"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
}
...
...
searchGuide/reducers/search.js
View file @
024bbea
...
...
@@ -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
();
...
...
Please
register
or
login
to post a comment