양지수

데이터저장형식결정필요

Showing 356 changed files with 147 additions and 0 deletions
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
1 +# KNU 한국어 감성사전
2 +# 작성자 : 온병원, 박상민, 나철원
3 +# 소속 : 군산대학교 소프트웨어융합공학과 Data Intelligence Lab
4 +# 홈페이지 : dilab.kunsan.ac.kr
5 +# 작성일 : 2018.05.14
6 +# 뜻풀이 데이터 출처 : https://github.com/mrchypark/stdkor
7 +# 신조어 데이터 출처 : https://ko.wikipedia.org/wiki/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD%EC%9D%98_%EC%9D%B8%ED%84%B0%EB%84%B7_%EC%8B%A0%EC%A1%B0%EC%96%B4_%EB%AA%A9%EB%A1%9D
8 +# 이모티콘 데이터 출처: https://ko.wikipedia.org/wiki/%EC%9D%B4%EB%AA%A8%ED%8B%B0%EC%BD%98
9 +# SentiWordNet_3.0.0_20130122 데이터 출처 : http://sentiwordnet.isti.cnr.it/
10 +# SenticNet-5.0 데이터 출처 : http://sentic.net/
11 +# 감정단어사전0603 데이터 출처 : http://datascience.khu.ac.kr/board/bbs/board.php?bo_table=05_01&wr_id=91
12 +# 김은영, “국어 감정동사 연구”, 2004.02, 학위논문(박사) - 전남대학교 국어국문학과 대학원
13 +
14 +#-*-coding:utf-8-*-
15 +
16 +import json
17 +
18 +import warnings
19 +warnings.simplefilter(("ignore"))
20 +import openpyxl
21 +import pandas as pd
22 +
23 +class KnuSL():
24 +
25 + def data_list(wordname):
26 + with open('KnuSentiLex/data/SentiWord_info.json', encoding='utf-8-sig', mode='r') as f:
27 + data = json.load(f)
28 + result = ['X','X']
29 +
30 + for i in range(0, len(data)):
31 + if data[i]['word'] == wordname:
32 + result.pop()
33 + result.pop()
34 + result.append(data[i]['word_root'])
35 + result.append(data[i]['polarity'])
36 +
37 + r_word = result[0] #어근
38 + s_word = result[1] #극성
39 +
40 + return s_word
41 +
42 +if __name__ == "__main__":
43 +
44 + ksl = KnuSL
45 +
46 + print("\nKNU 한국어 감성사전입니다~ :)")
47 + print("사전에 단어가 없는 경우 결과가 None으로 나타납니다!!!")
48 + print("종료하시려면 #을 입력해주세요!!!")
49 + print("-2:매우 부정, -1:부정, 0:중립 or Unkwon, 1:긍정, 2:매우 긍정")
50 + print("\n")
51 +
52 +filefolder = input("종목폴더입력: ")
53 +filename=input("파일이름입력:")
54 +filepos = "C:/Users/yangj/PycharmProjects/pythonProject1/뉴스키워드/"+filefolder+"/" + filename + ".xlsx"
55 +kfile = openpyxl.load_workbook(filepos)#파일이름입력
56 +ws=kfile.active
57 +data=[]
58 +i=0
59 +for row in ws.rows:
60 + data.append([])
61 + for cell in row:
62 + if cell.value != None:
63 + data[i].append(cell.value)
64 + i += 1
65 +print(type(data))
66 +del data[0] #첫번째 의미없는 열 삭제
67 +for i in range(len(data)):
68 + del data[i][0] #각 열의 첫번째 행 삭제
69 +print(data)
70 +
71 +KNUdata=[]
72 +
73 +for x in range(len(data)):
74 + KNUdata.append([])
75 + for y in range(len(data[x])):
76 + KNUdata[x].append(ksl.data_list(data[x][y]))
77 +
78 +df_list = pd.DataFrame(data)
79 +df_knu = pd.DataFrame(KNUdata)
80 +result = pd.concat([ df_list, df_knu], axis=1) #TfIf dataframe으로 변환
81 +result.to_excel(filename+' KNU'+'.xlsx')
1 +<component name="InspectionProjectProfileManager">
2 + <settings>
3 + <option name="USE_PROJECT_PROFILE" value="false" />
4 + <version value="1.0" />
5 + </settings>
6 +</component>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<module type="PYTHON_MODULE" version="4">
3 + <component name="NewModuleRootManager">
4 + <content url="file://$MODULE_DIR$" />
5 + <orderEntry type="inheritedJdk" />
6 + <orderEntry type="sourceFolder" forTests="false" />
7 + </component>
8 +</module>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7" project-jdk-type="Python SDK" />
4 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="ProjectModuleManager">
4 + <modules>
5 + <module fileurl="file://$PROJECT_DIR$/.idea/knu.iml" filepath="$PROJECT_DIR$/.idea/knu.iml" />
6 + </modules>
7 + </component>
8 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="VcsDirectoryMappings">
4 + <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5 + <mapping directory="$PROJECT_DIR$/KnuSentiLex" vcs="Git" />
6 + </component>
7 +</project>
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
1 +Metadata-Version: 2.1
2 +Name: mecab-python
3 +Version: 0.996-ko-0.9.2-msvc
4 +Summary: UNKNOWN
5 +Home-page: UNKNOWN
6 +Author: UNKNOWN
7 +Author-email: UNKNOWN
8 +License: UNKNOWN
9 +Platform: UNKNOWN
10 +
11 +UNKNOWN
12 +
13 +
1 +MeCab.py,sha256=cuvFTwJk_Z38aY54gIKoBtR46p6tPXOVSKkpoA1PcY4,15733
2 +_MeCab.cp37-win_amd64.pyd,sha256=u-WVy7oAK9dySDKhPh_DNHIWW4x6yHSwu6hjMKqdz5E,116736
3 +__pycache__/MeCab.cpython-37.pyc,,
4 +libmecab.dll,sha256=lRhwboyrXWEXXnDn8soNA05id3UvWfPpP7bvTXj5iH4,1908736
5 +mecab_python-0.996_ko_0.9.2_msvc.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
6 +mecab_python-0.996_ko_0.9.2_msvc.dist-info/METADATA,sha256=Qw4D_1k4TCzF1Ul5k47s6hOnafUJSLyiiGhqffEnszs,190
7 +mecab_python-0.996_ko_0.9.2_msvc.dist-info/RECORD,,
8 +mecab_python-0.996_ko_0.9.2_msvc.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9 +mecab_python-0.996_ko_0.9.2_msvc.dist-info/WHEEL,sha256=jmFYSwR2oi5DgMGgmnuB-EJxqLMkUojGGdmJ0wz35aI,106
10 +mecab_python-0.996_ko_0.9.2_msvc.dist-info/direct_url.json,sha256=8Wv8YjFpjisUlH--mXnzxpj5B8uexD6AtZjonw2yk5k,142
11 +mecab_python-0.996_ko_0.9.2_msvc.dist-info/top_level.txt,sha256=E6HHbCcV114TjQmzLJGG5aSu2Sb0tjGGxkjler1jxrQ,13
1 +Wheel-Version: 1.0
2 +Generator: bdist_wheel (0.31.1)
3 +Root-Is-Purelib: false
4 +Tag: cp37-cp37m-win_amd64
5 +
1 +{"archive_info": {}, "url": "file:///C:/Users/yangj/PycharmProjects/pythonProject1/mecab_python-0.996_ko_0.9.2_msvc-cp37-cp37m-win_amd64.whl"}
...\ No newline at end of file ...\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type