양지수

명사만추출하기 작성중_미완

Showing 1 changed file with 10 additions and 4 deletions
...@@ -5,7 +5,6 @@ from konlpy.tag import * ...@@ -5,7 +5,6 @@ from konlpy.tag import *
5 import openpyxl 5 import openpyxl
6 import pandas as pd 6 import pandas as pd
7 from math import log10 7 from math import log10
8 -from operator import itemgetter
9 import numpy as np 8 import numpy as np
10 9
11 #형태소분석라이브러리 10 #형태소분석라이브러리
...@@ -82,7 +81,14 @@ print(TfIf)#TFIF는 (단어,가중치) 조합으로 저장 ...@@ -82,7 +81,14 @@ print(TfIf)#TFIF는 (단어,가중치) 조합으로 저장
82 for i in range(len(TfIf)-1): 81 for i in range(len(TfIf)-1):
83 TfIf[i].sort(key=lambda x:x[1], reverse=True) #가중치기준 내림차순 정렬 82 TfIf[i].sort(key=lambda x:x[1], reverse=True) #가중치기준 내림차순 정렬
84 print(TfIf) 83 print(TfIf)
85 - 84 +onlynouns = []
86 -df= pd.DataFrame.from_records(TfIf)#TfIf dataframe으로 변환 85 +for i in range(len(TfIf)-1):
87 -df.to_excel(filename+'_가중치추출_내림정렬'+'.xlsx') 86 + onlynouns.append([])
87 + for j in range(len(TfIf[i])-1):
88 + for k in range(len(TfIf[i][j])+1):
89 + if k%2==0:
90 + onlynouns[i].append(TfIf[i][j][k])
91 +print(onlynouns)
92 +#df= pd.DataFrame.from_records(TfIf)#TfIf dataframe으로 변환
93 +#df.to_excel(filename+'_가중치추출_내림정렬'+'.xlsx')
88 94
......