Spaces:
Running
Running
remve unused tables
Browse files- scripts/eval_tables.py +0 -40
scripts/eval_tables.py
CHANGED
@@ -18,29 +18,6 @@ def create_eval_database():
|
|
18 |
);
|
19 |
''')
|
20 |
|
21 |
-
cursor.execute('''
|
22 |
-
CREATE TABLE IF NOT EXISTS rankers (
|
23 |
-
id SERIAL PRIMARY KEY,
|
24 |
-
ranker TEXT NOT NULL
|
25 |
-
);
|
26 |
-
''')
|
27 |
-
|
28 |
-
# Create table for unique sources
|
29 |
-
cursor.execute('''
|
30 |
-
CREATE TABLE IF NOT EXISTS baseline_sources (
|
31 |
-
id SERIAL PRIMARY KEY,
|
32 |
-
question_id INTEGER NOT NULL,
|
33 |
-
tractate TEXT NOT NULL,
|
34 |
-
folio TEXT NOT NULL,
|
35 |
-
sugya_id TEXT NOT NULL,
|
36 |
-
rank INTEGER NOT NULL,
|
37 |
-
reason TEXT,
|
38 |
-
ranker_id INTEGER NOT NULL,
|
39 |
-
FOREIGN KEY (question_id) REFERENCES questions(id),
|
40 |
-
FOREIGN KEY (ranker_id) REFERENCES rankers(id),
|
41 |
-
CONSTRAINT unique_source_per_question_ranker UNIQUE(question_id, sugya_id, ranker_id)
|
42 |
-
);
|
43 |
-
''')
|
44 |
|
45 |
cursor.execute('''
|
46 |
CREATE TABLE IF NOT EXISTS source_finders (
|
@@ -106,29 +83,12 @@ def load_source_finders():
|
|
106 |
cursor.execute("INSERT INTO source_finders (source_finder_type, source_finder_version) VALUES (%s, 1)", (item,))
|
107 |
conn.commit()
|
108 |
|
109 |
-
def load_rankers():
|
110 |
-
cursor = conn.cursor()
|
111 |
-
for item in ["claude_sources"]:
|
112 |
-
cursor.execute("INSERT INTO rankers (ranker) VALUES (%s)", (item,))
|
113 |
-
conn.commit()
|
114 |
-
|
115 |
-
def load_baseline_sources():
|
116 |
-
# copy all claude values where run_id = 1 from source_runs to baseline_sources
|
117 |
-
cursor = conn.cursor()
|
118 |
-
cursor.execute('''
|
119 |
-
INSERT INTO baseline_sources (question_id, tractate, folio, sugya_id, rank, reason, ranker_id)
|
120 |
-
SELECT question_id, tractate, folio, sugya_id, rank, reason, 1
|
121 |
-
FROM source_runs
|
122 |
-
WHERE run_id = 1 and source_finder_id = 1
|
123 |
-
''')
|
124 |
-
conn.commit()
|
125 |
|
126 |
|
127 |
|
128 |
if __name__ == '__main__':
|
129 |
# Create the database
|
130 |
create_eval_database()
|
131 |
-
# load_baseline_sources()
|
132 |
|
133 |
|
134 |
|
|
|
18 |
);
|
19 |
''')
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
cursor.execute('''
|
23 |
CREATE TABLE IF NOT EXISTS source_finders (
|
|
|
83 |
cursor.execute("INSERT INTO source_finders (source_finder_type, source_finder_version) VALUES (%s, 1)", (item,))
|
84 |
conn.commit()
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
|
88 |
|
89 |
if __name__ == '__main__':
|
90 |
# Create the database
|
91 |
create_eval_database()
|
|
|
92 |
|
93 |
|
94 |
|