Merge branch 'es' into 'master'
es branch merge request See merge request !2
Showing
12 changed files
with
139 additions
and
99 deletions
Dockerfile
0 → 100644
1 | -### 오픈 소스와 자연어 처리를 이용한 검색 쿼리 개선 | 1 | +### 오픈 소스와 자연어 처리를 이용한 검색 개선 |
2 | 2 | ||
3 | > 주제 | 3 | > 주제 |
4 | 4 | ||
5 | 검색 엔진 오픈 소스인 Elasticsearch 와 | 5 | 검색 엔진 오픈 소스인 Elasticsearch 와 |
6 | -자연어 처리 사전 학습 모델인 BERT 를 이용 하여 | 6 | +딥 러닝의 자연어 처리(NLP) 기술을 응용하여 |
7 | -검색 쿼리를 개선 하는 방법에 대해 연구 한다. | 7 | +질문형 검색을 만들고 개선 방안을 탐구 |
8 | 8 | ||
9 | > 사용된 기술 | 9 | > 사용된 기술 |
10 | 10 | ||
11 | - Elasticsearch | 11 | - Elasticsearch |
12 | -- BERT | ||
13 | - React.js | 12 | - React.js |
13 | +- NLP | ||
14 | 14 | ||
15 | 15 | ||
16 | > 상세 목표 | 16 | > 상세 목표 |
17 | 17 | ||
18 | -- Elasticsearch 에서 제공 하는 기본 자동 완성 기능 개선 | ||
19 | -- 자연어 처리 모델인 BERT 를 통해 질문형 검색 쿼리 개발 | ||
20 | -- React.js 를 이용해 Elasticsearch 와 연동 하여 웹 검색 사이트 개발 | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
18 | +- Elasticsearch 와 NLP 를 접목 시켜서 질문형 검색 개발 | ||
19 | +- Nori Analyzer 를 이용하여 한글에 대한 쿼리 개선 방안 탐구 | ||
20 | +- React.js 를 이용해 Elasticsearch 와 연동 하여 웹 검색 사이트 개발 | ... | ... |
docker-compose.yml
0 → 100644
1 | +version: '3.8' | ||
2 | +services: | ||
3 | + elasticsearch: | ||
4 | + image: docker.elastic.co/elasticsearch/elasticsearch:7.12.1 | ||
5 | + container_name: elasticsearch | ||
6 | + environment: | ||
7 | + - "discovery.type=single-node" | ||
8 | + ports: | ||
9 | + - 9200:9200 | ||
10 | + volumes: | ||
11 | + - es_data:/usr/share/elasticsearch/data | ||
12 | + kibana: | ||
13 | + image: docker.elastic.co/kibana/kibana:7.12.1 | ||
14 | + container_name: kibana | ||
15 | + environment: | ||
16 | + - ELASTICSEARCH_HOSTS=http://elasticsearch:9200 | ||
17 | + ports: | ||
18 | + - 5601:5601 | ||
19 | + depends_on: | ||
20 | + - elasticsearch | ||
21 | + web: | ||
22 | + container_name: react | ||
23 | + build: | ||
24 | + context: . | ||
25 | + dockerfile: Dockerfile | ||
26 | + volumes: | ||
27 | + - ".:/app" | ||
28 | + - "/app/node_modules" | ||
29 | + ports: | ||
30 | + - "3001:3000" | ||
31 | + environment: | ||
32 | + - NODE_ENV=development | ||
33 | + stdin_open: true | ||
34 | + tty: true | ||
35 | + | ||
36 | +volumes: | ||
37 | + es_data: | ||
38 | + driver: local |
This diff is collapsed. Click to expand it.
... | @@ -3,13 +3,19 @@ | ... | @@ -3,13 +3,19 @@ |
3 | "version": "0.1.0", | 3 | "version": "0.1.0", |
4 | "private": true, | 4 | "private": true, |
5 | "dependencies": { | 5 | "dependencies": { |
6 | + "@elastic/elasticsearch": "^7.12.0", | ||
6 | "@elastic/react-search-ui": "^1.5.1", | 7 | "@elastic/react-search-ui": "^1.5.1", |
7 | "@elastic/search-ui-app-search-connector": "^1.5.1", | 8 | "@elastic/search-ui-app-search-connector": "^1.5.1", |
9 | + "@tensorflow-models/qna": "^1.0.0", | ||
10 | + "@tensorflow/tfjs": "^3.5.0", | ||
8 | "@testing-library/jest-dom": "^5.11.4", | 11 | "@testing-library/jest-dom": "^5.11.4", |
9 | "@testing-library/react": "^11.1.0", | 12 | "@testing-library/react": "^11.1.0", |
10 | "@testing-library/user-event": "^12.1.10", | 13 | "@testing-library/user-event": "^12.1.10", |
14 | + "elasticsearch": "^16.7.2", | ||
15 | + "http-proxy-middleware": "^2.0.0", | ||
11 | "react": "^17.0.2", | 16 | "react": "^17.0.2", |
12 | "react-dom": "^17.0.2", | 17 | "react-dom": "^17.0.2", |
18 | + "react-loader-spinner": "^4.0.0", | ||
13 | "react-scripts": "4.0.3", | 19 | "react-scripts": "4.0.3", |
14 | "web-vitals": "^1.0.1" | 20 | "web-vitals": "^1.0.1" |
15 | }, | 21 | }, | ... | ... |
... | @@ -24,7 +24,7 @@ | ... | @@ -24,7 +24,7 @@ |
24 | work correctly both with client-side routing and a non-root public URL. | 24 | work correctly both with client-side routing and a non-root public URL. |
25 | Learn how to configure a non-root public URL by running `npm run build`. | 25 | Learn how to configure a non-root public URL by running `npm run build`. |
26 | --> | 26 | --> |
27 | - <title>React App</title> | 27 | + <title>Search App</title> |
28 | </head> | 28 | </head> |
29 | <body> | 29 | <body> |
30 | <noscript>You need to enable JavaScript to run this app.</noscript> | 30 | <noscript>You need to enable JavaScript to run this app.</noscript> | ... | ... |
1 | + | ||
1 | .App { | 2 | .App { |
3 | + height: 100%; | ||
2 | text-align: center; | 4 | text-align: center; |
3 | } | 5 | } |
4 | 6 | ||
... | @@ -14,14 +16,11 @@ | ... | @@ -14,14 +16,11 @@ |
14 | } | 16 | } |
15 | 17 | ||
16 | .App-header { | 18 | .App-header { |
17 | - background-color: #282c34; | 19 | + height: 100%; |
18 | - min-height: 100vh; | ||
19 | display: flex; | 20 | display: flex; |
20 | flex-direction: column; | 21 | flex-direction: column; |
21 | align-items: center; | 22 | align-items: center; |
22 | justify-content: center; | 23 | justify-content: center; |
23 | - font-size: calc(10px + 2vmin); | ||
24 | - color: white; | ||
25 | } | 24 | } |
26 | 25 | ||
27 | .App-link { | 26 | .App-link { | ... | ... |
1 | -import React from "react"; | 1 | +import React, {Fragment, useState} from "react"; |
2 | -import AppSearchAPIConnector from "@elastic/search-ui-app-search-connector"; | 2 | +import { Client } from "elasticsearch" |
3 | -import { SearchProvider, Results, SearchBox } from "@elastic/react-search-ui"; | 3 | +import "./App.css"; |
4 | -import { Layout} from "@elastic/react-search-ui-views"; | ||
5 | -import "@elastic/react-search-ui-views/lib/styles/styles.css"; | ||
6 | -import './App.css'; | ||
7 | 4 | ||
8 | -const connector = new AppSearchAPIConnector({ | 5 | +function App() { |
9 | - searchKey: "[search-4td7gan5kcasgygjcyexksrz]", | ||
10 | - engineName: "video-games", | ||
11 | - hostIdentifier: "[private-bhi6v1txusox87eag2c8qgu3]" | ||
12 | -}); | ||
13 | 6 | ||
14 | -const configurationOptions = { | 7 | + const [answer, setAnswer] = useState(''); |
15 | - apiConnector: connector, | 8 | + const [inputValue, setInputValue] = useState(''); |
16 | - searchQuery: { | 9 | + |
17 | - search_fields: { | 10 | + const client = new Client({ |
18 | - name: {} | 11 | + host: 'http://localhost:9200' |
19 | - }, | 12 | + }); |
20 | - result_fields: { | 13 | + |
21 | - name: { | 14 | + const onKeyUpHandler = async (event) => { |
22 | - snippet: { | 15 | + if (event.charCode === 13) { |
23 | - size: 75 | 16 | + setInputValue(event.target.value); |
24 | - } | 17 | + |
25 | - }, | 18 | + if (inputValue !== '' || inputValue !== undefined || inputValue.length !== 0) { |
26 | - genre: { | 19 | + console.log(inputValue); |
27 | - snippet: { | 20 | + try { |
28 | - size: 50, | 21 | + const result = await client.search({ |
29 | - fallback: true | 22 | + index: "wiki-qna2", |
30 | - } | 23 | + body: { |
31 | - }, | 24 | + query: { |
32 | - publisher: { | 25 | + match: { |
33 | - snippet: { | 26 | + "질문(원문, 하 난이도)": inputValue |
34 | - size: 50, | ||
35 | - fallback: true | ||
36 | - } | ||
37 | - }, | ||
38 | - critic_score: { | ||
39 | - raw: {} | ||
40 | - }, | ||
41 | - user_score: { | ||
42 | - raw: {} | ||
43 | - }, | ||
44 | - platform: { | ||
45 | - snippet: { | ||
46 | - size: 50, | ||
47 | - fallback: true | ||
48 | } | 27 | } |
49 | - }, | 28 | + } |
50 | - image_url: { | ||
51 | - raw: {} | ||
52 | } | 29 | } |
53 | - }, | 30 | + }); |
54 | - facets: { | 31 | + |
55 | - user_score: { | 32 | + if (result !== null || result !== undefined || result.length !== 0) { |
56 | - type: "range", | 33 | + setAnswer(result.hits.hits); |
57 | - ranges: [ | 34 | + } |
58 | - { from: 0, to: 5, name: "Not good" }, | 35 | + } catch (error) { |
59 | - { from: 5, to: 7, name: "Not bad" }, | 36 | + console.log(error); |
60 | - { from: 7, to: 9, name: "Pretty good" }, | ||
61 | - { from: 9, to: 10, name: "Must play!" } | ||
62 | - ] | ||
63 | - }, | ||
64 | - critic_score: { | ||
65 | - type: "range", | ||
66 | - ranges: [ | ||
67 | - { from: 0, to: 50, name: "Not good" }, | ||
68 | - { from: 50, to: 70, name: "Not bad" }, | ||
69 | - { from: 70, to: 90, name: "Pretty good" }, | ||
70 | - { from: 90, to: 100, name: "Must play!" } | ||
71 | - ] | ||
72 | - }, | ||
73 | - genre: { type: "value", size: 100 }, | ||
74 | - publisher: { type: "value", size: 100}, | ||
75 | - platform: { type: "value", size: 100} | ||
76 | } | 37 | } |
38 | + } | ||
77 | } | 39 | } |
78 | -}; | 40 | + } |
79 | 41 | ||
80 | -function App() { | 42 | + const showAnswer = (answer) => { |
81 | - return ( | 43 | + return ( |
82 | - <SearchProvider config={configurationOptions}> | 44 | + <div> |
83 | - <div className="App"> | 45 | + <b>{answer !== undefined ? answer._source.정답 : 'loading ....'}</b> |
84 | - <Layout | ||
85 | - header={<SearchBox />} | ||
86 | - bodyContent={<Results titleField="name" urlField="image_url"/>} | ||
87 | - /> | ||
88 | </div> | 46 | </div> |
89 | - </SearchProvider> | 47 | + ) |
48 | + } | ||
49 | + | ||
50 | + return ( | ||
51 | + <div className="App"> | ||
52 | + <header className="App-header"> | ||
53 | + <Fragment> | ||
54 | + Ask a Question | ||
55 | + <input size="80" onKeyPress={onKeyUpHandler}/> | ||
56 | + <div> | ||
57 | + -- Answers -- | ||
58 | + <div> | ||
59 | + {answer === '' ? " loading answer..." : showAnswer(answer[0])} | ||
60 | + </div> | ||
61 | + </div> | ||
62 | + </Fragment> | ||
63 | + </header> | ||
64 | + </div> | ||
90 | ); | 65 | ); |
91 | } | 66 | } |
92 | 67 | ... | ... |
1 | +html { | ||
2 | + width: 100%; | ||
3 | + height: 100%; | ||
4 | +} | ||
5 | + | ||
1 | body { | 6 | body { |
2 | margin: 0; | 7 | margin: 0; |
3 | - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', | 8 | + padding: 0; |
4 | - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', | 9 | + width: 100%; |
5 | - sans-serif; | 10 | + height: 100%; |
6 | - -webkit-font-smoothing: antialiased; | 11 | + background-color: #24262E; |
7 | - -moz-osx-font-smoothing: grayscale; | 12 | + color: white; |
13 | +} | ||
14 | + | ||
15 | +#root { | ||
16 | + width: 100%; | ||
17 | + height: 100%; | ||
8 | } | 18 | } |
9 | 19 | ||
10 | code { | 20 | code { |
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', | 21 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', |
12 | - monospace; | 22 | + monospace; |
13 | } | 23 | } | ... | ... |
This diff is collapsed. Click to expand it.
보고서/4월 29일 면담보고서.hwp
0 → 100644
No preview for this file type
보고서/중간보고서_2017110273_신동윤.pdf
0 → 100644
No preview for this file type
-
Please register or login to post a comment