양지수

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

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