-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.py
71 lines (64 loc) · 2.08 KB
/
config.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os
data = 'data/'
db = 'db/'
model = 'model/'
result = 'result/'
tmp = 'tmp/'
def init():
if not os.path.exists(data):
os.mkdirs(data)
if not os.path.exists(db):
os.mkdirs(db)
if not os.path.exists(model):
os.mkdirs(model)
if not os.path.exists(result):
os.mkdirs(result)
if not os.path.exists(tmp):
os.mkdirs(tmp)
class PathList:
def __init__(self): # default setting
# word vectors file
self.zh_model = model+'sgns.baidubaike.bigram-char'
self.en_model = model+'glove.6B.200d.txt'
# zh files
self.jieba_dict = model+'dict.txt'
self.zh_kp_list = model+'zh_kp_list'
self.zh_stopwords = model+'zh_stopwords'
self.snippets_zh = db+'snippets_zh.db'
# en files
self.en_kp_list = model+'en_kp_list'
self.en_stopwords = model+'en_stopwords'
self.snippets_en = db+'snippets_en.db'
self.hunpos_model = model+'english.model'
if os.name == 'nt': # windows
self.hunpos_bin = model+'hunpos/hunpos-tag.exe'
else:
self.hunpos_bin = model+'hunpos/hupos-tag'
# paths
self.result = result+'result'
self.tmp = tmp+'tmp'
self.input = tmp+'input'
self.seed = tmp+'seed'
# example inputs
self.input_text = data+'example_text_zh.txt'
self.input_seed = data+'example_seed_zh.txt'
#self.input_text = data+'en/captions/EN-Eco'
#self.input_seed = data+'en/seeds/EN-Eco'
self.no_seed = False # if true, every candidate will be a seed
class Parameter:
def __init__(self): # default setting
self.language = 'zh'
self.task = 'extract'
self.iter_time = 100
self.max_num = -1
self.threshold = 0.7
self.decay = 0.8
def set_language(self, language):
self.language = language
assert self.language in ['en', 'zh']
def set_task(self, task):
self.task = task
assert self.task in ['extract', 'expand']
init()
path_list = PathList()
parameter = Parameter()