Skip to content

Commit

Permalink
update generate.py
Browse files Browse the repository at this point in the history
  • Loading branch information
epico committed Nov 29, 2018
1 parent c2b6bcf commit fa478cd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions generate.py
Expand Up @@ -21,8 +21,10 @@
def generateOneText(infile, modelfile, reportfile):
infilestatuspath = infile + config.getStatusPostfix()
infilestatus = utils.load_status(infilestatuspath)
if not utils.check_epoch(infilestatus, 'MergeSequence'):
raise utils.EpochError('Please mergeseq first.\n')
if not utils.check_epoch(infilestatus, 'Segment'):
raise utils.EpochError('Please segment first.\n')
if utils.check_epoch(infilestatus, 'MergeSequence'):
raise utils.EpochError('Please skip mergeseq.\n')
if utils.check_epoch(infilestatus, 'Generate'):
return False

Expand All @@ -34,7 +36,7 @@ def generateOneText(infile, modelfile, reportfile):
str(config.getMaximumIncreaseRatesAllowed()), \
'--k-mixture-model-file', \
modelfile, infile + \
config.getMergedPostfix()]
config.getSegmentPostfix()]
subprocess = Popen(cmdline, shell=False, stderr=PIPE, \
close_fds=True)

Expand Down Expand Up @@ -105,8 +107,10 @@ def storeModelStatus(modelfile, textnum, nexttextnum):

indexstatuspath = indexpath + config.getStatusPostfix()
indexstatus = utils.load_status(indexstatuspath)
if not utils.check_epoch(indexstatus, 'MergeSequence'):
raise utils.EpochError('Please mergeseq first.\n')
if not utils.check_epoch(indexstatus, 'Segment'):
raise utils.EpochError('Please segment first.\n')
if utils.check_epoch(indexstatus, 'MergeSequence'):
raise utils.EpochError('Please skip mergeseq.\n')
if utils.check_epoch(indexstatus, 'Generate'):
return

Expand Down Expand Up @@ -134,7 +138,7 @@ def storeModelStatus(modelfile, textnum, nexttextnum):
oneline = oneline.rstrip(os.linesep)
(title, textpath) = oneline.split('#')
infile = config.getTextDir() + textpath
infilesize = utils.get_file_length(infile + config.getMergedPostfix())
infilesize = utils.get_file_length(infile + config.getSegmentPostfix())
if infilesize < config.getMinimumFileSize():
print("Skipping " + title + '#' + textpath)
continue
Expand Down

0 comments on commit fa478cd

Please sign in to comment.