-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.py
98 lines (77 loc) · 3.19 KB
/
configuration.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import os
class ConfigClass:
def __init__(self):
# link to a zip file in google drive with your pretrained model
self._model_url = 'https://drive.google.com/file/d/1oXRanO6zdOkZbIZkEZ16R00I2JWd_M_Z/view?usp=sharing'
# False/True flag indicating whether the testing system will download
# and overwrite the existing model files. In other words, keep this as
# False until you update the model, submit with True to download
# the updated model (with a valid model_url), then turn back to False
# in subsequent submissions to avoid the slow downloading of the large
# model file with every submission.
self._download_model = False
self.corpusPath = '/data'
self.savedFileMainFolder = 'output_path'
self.saveFilesWithStem = self.savedFileMainFolder + "/WithStem"
self.saveFilesWithoutStem = self.savedFileMainFolder + "/WithoutStem"
self.toStem = False
self.oneFile = True
self.cutFreqBy = 1000
self.google_news_vectors_negative300_path = '../../../../GoogleNews-vectors-negative300.bin'
self.glove_twitter_27B_25d_path = '../../../../glove.twitter.27B.25d.txt'
print('Project was created successfully..')
def setoneFile(self,bool):
self.oneFile = bool
def getoneFile(self):
return self.oneFile
def get_outputPath(self):
if self.toStem:
try:
if not os.path.exists(self.saveFilesWithStem):
os.makedirs(self.saveFilesWithStem)
except:
pass
#print("fail in creating output folder")
return self.saveFilesWithStem + "/"
else:
try:
if not os.path.exists(self.saveFilesWithoutStem):
os.makedirs(self.saveFilesWithoutStem)
except:
pass
#print("fail in creating output folder")
return self.saveFilesWithoutStem + "/"
def get__corpusPath(self):
return self.corpusPath
def set_corpusPath(self, corpusPath):
self.corpusPath = corpusPath
def get_saveFilesWithStem(self):
return self.saveFilesWithStem
def get_saveFilesWithoutStem(self):
return self.saveFilesWithStem
def get_savedFileMainFolder(self):
return self.savedFileMainFolder
def set_savedFileMainFolder(self, path):
self.savedFileMainFolder = path + "/WithStem"
self.saveFilesWithStem = path+ "/WithStem"
self.saveFilesWithoutStem = path + "/WithoutStem"
try:
if not os.path.exists(path):
os.makedirs(path)
except:
pass
#print("fail in creating main output folder")
def set_toStem(self, bool):
self.toStem = bool
def get_spellingCorrection(self):
return self.spellingCorrection
def set_spellingCorrection(self, flag):
self.spellingCorrection = flag
def get_model_url(self):
return self._model_url
def get_download_model(self):
return self._download_model
def get_cut_by(self):
return self.cutFreqBy
def set_cut_by(self,num):
self.cutFreqBy = num/6