summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2018-11-29 10:59:04 +0800
committerPeng Wu <alexepico@gmail.com>2018-11-29 10:59:04 +0800
commitfa478cdc53d7e882804f3bfc613ff9f6182ab209 (patch)
tree802fc2cee30e8f1658d41efba0189e5a8dd3fdd2
parentc2b6bcf988dcf6f8af9c02514cf37e41624fb24b (diff)
downloadtrainer-master.zip
trainer-master.tar.gz
trainer-master.tar.xz
update generate.pyHEADmaster
-rwxr-xr-xgenerate.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/generate.py b/generate.py
index 4c931af..185366a 100755
--- a/generate.py
+++ b/generate.py
@@ -21,8 +21,10 @@ os.chdir(libpinyin_sub_dir)
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
@@ -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)
@@ -105,8 +107,10 @@ def handleOneIndex(indexpath, subdir, indexname, fast):
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
@@ -134,7 +138,7 @@ def handleOneIndex(indexpath, subdir, indexname, fast):
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