tobby48 5 years ago
parent
commit
9b30b0ba21

+ 28
- 0
src/main/python/kr/co/swh/lecture/opensource/project/discord/make-sentimental-dictionary.py View File

@@ -0,0 +1,28 @@
1
+import pymysql.cursors
2
+import requests
3
+
4
+conn = pymysql.connect(host='dev-swh.ga',
5
+                       user='root',
6
+                       password='swhacademy!',
7
+                       db='market',
8
+                       charset='utf8')
9
+try:
10
+    with conn.cursor() as cursor:
11
+        sql = '''
12
+            CREATE TABLE sentimental (
13
+                word_root varchar(255) NOT NULL,
14
+                polarity int(11) NOT NULL
15
+            ) ENGINE=InnoDB DEFAULT CHARSET=utf8
16
+'''
17
+        cursor.execute(sql)
18
+
19
+        URL = 'https://raw.githubusercontent.com/park1200656/KnuSentiLex/master/data/SentiWord_info.json'
20
+        response = requests.get(URL)
21
+        data = response.json()
22
+        for b in data:
23
+            sql = 'INSERT INTO sentimental (word_root, polarity) VALUES (%s, %s)'
24
+            cursor.execute(sql, (b['word_root'], b['polarity']))
25
+    conn.commit()
26
+    print(cursor.lastrowid)
27
+finally:
28
+    conn.close()

src/main/python/kr/co/swh/lecture/opensource/project/naver-blog-nlp-ranking-d3-step3.py → src/main/python/kr/co/swh/lecture/opensource/project/naverblog/naver-blog-nlp-ranking-d3-step3.py View File


src/main/python/kr/co/swh/lecture/opensource/project/naver-blog-nlp-ranking-step2.py → src/main/python/kr/co/swh/lecture/opensource/project/naverblog/naver-blog-nlp-ranking-step2.py View File


src/main/python/kr/co/swh/lecture/opensource/project/naver-blog-step1.py → src/main/python/kr/co/swh/lecture/opensource/project/naverblog/naver-blog-step1.py View File

@@ -1,4 +1,3 @@
1
-from konlpy.tag import Kkma
2 1
 import os
3 2
 import sys
4 3
 import urllib.request

src/main/python/kr/co/swh/lecture/opensource/project/templates/naver-blog-nlp-ranking-d3.html → src/main/python/kr/co/swh/lecture/opensource/project/naverblog/templates/naver-blog-nlp-ranking-d3.html View File