-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
76 lines (53 loc) · 1.78 KB
/
app.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
import sys
# SOLR Mime Core
from Solr.MIME import MIME_Core
# Importing the data directory
from util.constant import DATA_DIR
# MIME Modue
from MimeDiversity import ComputeMIME
# Parser Module
from ParserDiversity.getParserInfo import Parser
# Language Module
from LanguageDiversity.ComputeLanguage import GetLanguageInformation
# Measurement Module
from MeasurementDiversity.ComputeMeasurement import GetMeasurementInformation
# Open NLP NER Module
from NERDiversity.OpenNLP_NER import ExtractNER
# The files to be loaded into solr
from SolrData import mimeData
from FileDiversity import ComputeFileSize
# override flag to override any flag set below
overrideFlag = False
# Flag to control clearing the solr index
resetSolrData = False
# Various Flags to control which module would run
computeFileSize = False
commuteMIME = False
commuteParser = False
commuteLanguage = False
commuteMeasurement = False
commuteOPEN_NER = True
if __name__ == '__main__':
mime = MIME_Core()
orig_stdout = sys.stdout
f = file('app.log', 'w')
sys.stdout = f
if overrideFlag or resetSolrData:
mime.delete('*:*')
if overrideFlag or resetSolrData:
# Loading the files into solr
mimeData.MIME(DATA_DIR).loadData()
if overrideFlag or commuteMIME:
ComputeMIME.GetMIMEInformation().addMime()
if overrideFlag or computeFileSize:
size = ComputeFileSize.FileSize().addSize()
if overrideFlag or commuteParser:
parser = Parser().addMetaDataSize()
if overrideFlag or commuteLanguage:
GetLanguageInformation().addLanguage()
if overrideFlag or commuteMeasurement:
GetMeasurementInformation().addMeasurement()
if overrideFlag or commuteOPEN_NER:
ExtractNER().addNER()
sys.stdout = orig_stdout
f.close()