forked from UW-xDD/stromatolites_snorkel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
executable file
·78 lines (57 loc) · 2.93 KB
/
run.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
#==============================================================================
#RUN ALL - STROMATOLITES
#==============================================================================
#path: /Users/jhusson/local/bin/deepdive-0.7.1/deepdive-apps/stromatolites
#==============================================================================
import os, time, subprocess, yaml
#tic
start_time = time.time()
#load configuration file
with open('./config', 'r') as config_yaml:
config = yaml.load(config_yaml)
#load credentials file
with open('./credentials', 'r') as credential_yaml:
credentials = yaml.load(credential_yaml)
#ensure working directory is proper
#os.chdir("/Users/jhusson/local/bin/deepdive-0.7.1/deepdive-apps/stromatolites")
#INITALIZE THE POSTGRES TABLES
print 'Step 1: Initialize the PSQL tables ...'
subprocess.call('./setup/setup.sh', shell=True)
os.system('python ./udf/initdb.py')
#BUILD THE BIBLIOGRAPHY
print 'Step 2: Build the bibliography ...'
os.system('python ./udf/buildbib.py')
#FIND TARGET INSTANCES
print 'Step 3: Find stromatolite instances ...'
os.system('python ./udf/ext_target.py')
#FIND STRATIGRAPHIC ENTITIES
print 'Step 4: Find stratigraphic entities ...'
os.system('python ./udf/ext_strat_phrases.py')
#FIND STRATIGRAPHIC MENTIONS
print 'Step 5: Find stratigraphic mentions ...'
os.system('python ./udf/ext_strat_mentions.py')
#CHECK AGE - UNIT MATCH AGREEMENT
print 'Step 6: Check age - unit match agreement ...'
os.system('python ./udf/ext_age_check.py')
#DEFINE RELATIONSHIPS BETWEEN TARGET AND STRATIGRAPHIC NAMES
print 'Step 7: Define the relationships between stromatolite phrases and stratigraphic entities/mentions ...'
os.system('python ./udf/ext_strat_target.py')
#DEFINE RELATIONSHIPS BETWEEN TARGET AND DISTANT STRATIGRAPHIC NAMES
print 'Step 8: Define the relationships between stromatolite phrases and distant stratigraphic entities/mentions ...'
os.system('python ./udf/ext_strat_target_distant.py')
#DEFINE RELATIONSHIPS BETWEEN TARGET AND DISTANT STRATIGRAPHIC NAMES
print 'Step 9: Delineate reference section from main body extractions ...'
os.system('python ./udf/ext_references.py')
#BUILD A BEST RESULTS TABLE OF STROM-STRAT_NAME TUPLES
print 'Step 10: Build a best results table of strom-strat_name tuples ...'
os.system('python ./udf/ext_results.py')
#FIND ADJECTIVES DESCRIBING STROM
print 'Step 11: Find adjectives describing strom target words ...'
os.system('python ./udf/ext_target_adjective.py')
#POSTGRES DUMP
print 'Step 12: Dump select results from PSQL ...'
output = 'pg_dump -U '+ credentials['postgres']['user'] + ' -t results -t strat_target -t strat_target_distant -t age_check -t refs_location -t bib -t target_adjectives -d ' + credentials['postgres']['database'] + ' > ./output/output.sql'
subprocess.call(output, shell=True)
#summary of performance time
elapsed_time = time.time() - start_time
print '\n ###########\n\n elapsed time: %d seconds\n\n ###########\n\n' %(elapsed_time)