forked from ScilifelabDataCentre/dc-dynamic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_clouds.py
50 lines (46 loc) · 2.72 KB
/
gen_clouds.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
50
import os
import livewordcloud as lwc
PATH = os.environ.get('PYTHONPATH')
CODE_PATH = os.environ.get('CODE_PATH')
# titles
lwc.write_file(os.path.join(CODE_PATH, 'output/covid-portal-titles_all.png'),
lwc.gen_wordcloud(field='title',
data_folder=PATH,
xsize=10,
shape='rectangle'))
lwc.write_file(os.path.join(CODE_PATH, 'output/covid-portal-titles_vr.png'),
lwc.gen_wordcloud(field='title',
data_folder=PATH,
json_path='https://publications-covid19.scilifelab.se/label/Funder%3A%20VR.json',
maxwords=100))
lwc.write_file(os.path.join(CODE_PATH, 'output/covid-portal-titles_kaw.png'),
lwc.gen_wordcloud(field='title',
data_folder=PATH,
json_path='https://publications-covid19.scilifelab.se/label/Funder%3A%20KAW/SciLifeLab.json',
maxwords=100))
lwc.write_file(os.path.join(CODE_PATH, 'output/covid-portal-titles_h2020.png'),
lwc.gen_wordcloud(field='title',
data_folder=PATH,
json_path='https://publications-covid19.scilifelab.se/label/Funder%3A%20H2020.json',
maxwords=100))
# abstracts
lwc.write_file(os.path.join(CODE_PATH, 'output/covid-portal-abstracts_all.png'),
lwc.gen_wordcloud(field='abstract',
data_folder=PATH,
xsize=10,
shape='rectangle'))
lwc.write_file(os.path.join(CODE_PATH, 'output/covid-portal-abstracts_vr.png'),
lwc.gen_wordcloud(field='abstract',
data_folder=PATH,
json_path='https://publications-covid19.scilifelab.se/label/Funder%3A%20VR.json',
maxwords=100))
lwc.write_file(os.path.join(CODE_PATH, 'output/covid-portal-abstracts_kaw.png'),
lwc.gen_wordcloud(field='abstract',
data_folder=PATH,
json_path='https://publications-covid19.scilifelab.se/label/Funder%3A%20KAW/SciLifeLab.json',
maxwords=100))
lwc.write_file(os.path.join(CODE_PATH, 'output/covid-portal-abstracts_h2020.png'),
lwc.gen_wordcloud(field='abstract',
data_folder=PATH,
json_path='https://publications-covid19.scilifelab.se/label/Funder%3A%20H2020.json',
maxwords=100))