-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
49 lines (37 loc) · 1.49 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# coding: utf-8
# Author: zhenda
from src.gen_word_cloud import *
from src.gen_word_cloud_echarts import gene_wc_echarts, dict2list
from src.utils.gene_fold import gene_fold
from src.utils.mylog import setlogging
def gene_bbe(num):
words_list = read_words_bbe(file='resources/bbe.txt')
stop_words = read_stop_words(file='resources/stop_words.txt')
res_dict = get_res_dict(words_list, stop_words)
for i in range(num):
draw_word_img(res_dict, f'out/bbe_wordcloud{i}.png')
def gene_hgb(num):
words_list = read_words_hgb(file='resources/hgb.txt')
stop_words = read_stop_words(file='resources/stop_words.txt')
res_dict = get_res_dict(words_list, stop_words)
for i in range(num):
draw_word_img(res_dict, f'out/hgb_wordcloud{i}.png')
def gene_bbe_echarts():
words_list = read_words_bbe(file='resources/bbe.txt')
stop_words = read_stop_words(file='resources/stop_words.txt')
res_dict = get_res_dict(words_list, stop_words)
res_lst = dict2list(res_dict)
gene_wc_echarts(res_lst, f'out/bbe_wordcloud.html')
def gene_hgb_echarts():
words_list = read_words_hgb(file='resources/hgb.txt')
stop_words = read_stop_words(file='resources/stop_words.txt')
res_dict = get_res_dict(words_list, stop_words)
res_lst = dict2list(res_dict)
gene_wc_echarts(res_lst, f'out/hgb_wordcloud.html')
if __name__ == '__main__':
gene_fold('out')
setlogging('out/main.log')
# gene_bbe(2)
# gene_hgb(2)
gene_bbe_echarts()
gene_hgb_echarts()