Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bluejoyq
/
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
김서영
2019-11-25 11:47:56 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b7e2eed88fa9cec86e73627c269655211d77e785
b7e2eed8
1 parent
60dfc9bc
add description
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
api/apiRequest.js
api/apiRequest.js
View file @
b7e2eed
// api key
require
(
'dotenv'
).
config
();
// api key error check
try
{
if
(
process
.
env
.
TEST
!=
"OKAY"
)
{
throw
new
Error
(
"키 오류 키파일을 확인하세요"
);
...
...
@@ -75,6 +77,27 @@ apiRequest.Korean = async ( text ) => {
});
}
apiRequest
.
multiETRI
=
async
(
searchResults
,
keywordText
)
=>
{
try
{
const
Promises
=
await
searchResults
.
map
((
searchResult
,
index
)
=>
{
//return makeOption( searchResults, keywordText, index );
return
DOCVECAPI
(
searchResults
,
keywordText
,
index
);
});
await
Promise
.
all
(
Promises
);
}
catch
(
err
)
{
throw
new
Error
(
err
.
message
);
}
}
/**
* @param {String} keywordText 사용자의 검색에서 textAnalystic을 거쳐 keyword만 남은 text
* @param {{title:string,passage:string,ulr:string}} searchResult searchResults keywordtext문장을 검색하여 나온 결과들
* @returns confidence key와 해당 value가 추가된 searchResults
* @description DOCVECAPI를 이용해 각각의 searchResult의 keywordtext에 대한 정확도(confidence, 검색문장에 대해 검색 결과가 얼마나 지)를
* 판단하고, confidence key와 해당 value를 searchResult에 추가해줍니다.
*/
const
DOCVECAPI
=
(
searchResults
,
keywordText
,
index
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
apiReqOption
=
{
...
...
Please
register
or
login
to post a comment