Showing
2 changed files
with
6 additions
and
3 deletions
hmm1월_가중치추출.xlsx
0 → 100644
No preview for this file type
... | @@ -6,6 +6,7 @@ import openpyxl | ... | @@ -6,6 +6,7 @@ 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 | 8 | from operator import itemgetter |
9 | +import numpy as np | ||
9 | 10 | ||
10 | #형태소분석라이브러리 | 11 | #형태소분석라이브러리 |
11 | #okt = Okt() | 12 | #okt = Okt() |
... | @@ -78,8 +79,10 @@ if __name__ == '__main__': | ... | @@ -78,8 +79,10 @@ if __name__ == '__main__': |
78 | #print(result) | 79 | #print(result) |
79 | TfIf.append(result) | 80 | TfIf.append(result) |
80 | print(TfIf)#TFIF는 (단어,가중치) 조합으로 저장 | 81 | print(TfIf)#TFIF는 (단어,가중치) 조합으로 저장 |
82 | +for i in range(len(TfIf)-1): | ||
83 | + TfIf[i].sort(key=lambda x:x[1], reverse=True) #가중치기준 내림차순 정렬 | ||
84 | +print(TfIf) | ||
81 | 85 | ||
82 | - | 86 | +df= pd.DataFrame.from_records(TfIf)#TfIf dataframe으로 변환 |
83 | -#df= pd.DataFrame.from_records(TfIf)#TfIf dataframe으로 변환 | 87 | +df.to_excel(filename+'_가중치추출_내림정렬'+'.xlsx') |
84 | -#df.to_excel(filename+'_가중치추출'+'.xlsx') | ||
85 | 88 | ... | ... |
-
Please register or login to post a comment