step_done now implemented in database.py
This commit is contained in:
parent
3ea62ed242
commit
33528f1495
|
@ -24,3 +24,12 @@ class Database:
|
|||
|
||||
def commit(self):
|
||||
self.db.commit()
|
||||
|
||||
def is_step_done(self, step_name):
|
||||
wc_done = self.db.execute("SELECT count(*) FROM StepsDone WHERE step=?", (step_name, )).fetchone()
|
||||
return wc_done[0] != 0
|
||||
|
||||
def step_is_done(self, step_name):
|
||||
self.db.execute("INSERT INTO StepsDone (step) VALUES (?)", (step_name, ))
|
||||
self.db.commit()
|
||||
|
||||
|
|
|
@ -104,9 +104,7 @@ class MatchStore:
|
|||
|
||||
def determine_colocation_dispersions(self):
|
||||
step_name = 'dispersions'
|
||||
wc_done = self.db.execute("SELECT count(*) FROM StepsDone WHERE step=?", (step_name, )).fetchone()
|
||||
|
||||
if wc_done[0] == 1:
|
||||
if self.db.is_step_done(step_name):
|
||||
self.load_dispersions()
|
||||
return
|
||||
|
||||
|
@ -120,9 +118,7 @@ class MatchStore:
|
|||
print("Storing dispersions...")
|
||||
self.store_dispersions()
|
||||
|
||||
self.db.execute("INSERT INTO StepsDone (step) VALUES (?)", (step_name, ))
|
||||
self.db.commit()
|
||||
|
||||
self.db.step_is_done(step_name)
|
||||
|
||||
def store_dispersions(self):
|
||||
for (structure_id, component_id, lemma), disp in self.dispersions.items():
|
||||
|
|
|
@ -43,8 +43,7 @@ class WordStats:
|
|||
|
||||
def generate_renders(self):
|
||||
step_name = 'generate_renders'
|
||||
wc_done = self.db.execute("SELECT count(*) FROM StepsDone WHERE step=?", (step_name, )).fetchone()
|
||||
if wc_done[0] == 1:
|
||||
if self.db.is_step_done(step_name):
|
||||
print("Skipping GenerateRenders, already complete")
|
||||
return
|
||||
|
||||
|
@ -58,8 +57,7 @@ class WordStats:
|
|||
self.db.execute("INSERT INTO WordCount (lemma, msd0, frequency) VALUES (?,?,?)",
|
||||
(lemma, msd0, freq))
|
||||
|
||||
self.db.execute("INSERT INTO StepsDone (step) VALUES (?)", (step_name, ))
|
||||
self.db.commit()
|
||||
self.db.step_is_done(step_name)
|
||||
|
||||
def common_lemma_msd(self, lemma, msd):
|
||||
lf = self.lemma_features
|
||||
|
|
Loading…
Reference in New Issue
Block a user