diff options
author | Peng Wu <alexepico@gmail.com> | 2011-07-26 18:40:54 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-07-26 18:40:54 +0800 |
commit | 2575950b486c9716174a14a8b5ad8c04fa086a14 (patch) | |
tree | 8855b9414ea3607da384451f6c8d0e66740d7984 /generate.py | |
parent | 04428f228cbe184618736a49fd23051301a5293a (diff) | |
download | trainer-2575950b486c9716174a14a8b5ad8c04fa086a14.tar.gz trainer-2575950b486c9716174a14a8b5ad8c04fa086a14.tar.xz trainer-2575950b486c9716174a14a8b5ad8c04fa086a14.zip |
fixes pep8 warnings
Diffstat (limited to 'generate.py')
-rwxr-xr-x | generate.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/generate.py b/generate.py index 4ff4e4f..b28c8d5 100755 --- a/generate.py +++ b/generate.py @@ -16,6 +16,7 @@ libpinyin_sub_dir = os.path.join(libpinyin_dir, 'utils', 'training') os.chdir(libpinyin_sub_dir) #chdir done + def handleError(error): sys.exit(error) @@ -47,12 +48,13 @@ def generateOneText(infile, modelfile, reportfile): f.writelines(lines) f.close() - os.waitpid(subprocess.pid, 0); + os.waitpid(subprocess.pid, 0) #end processing utils.sign_epoch(infilestatus, 'Generate') utils.store_status(infilestatuspath, infilestatus) + #Note: should check the corpus file size, and skip the too small text file. def handleOneIndex(indexpath, subdir, indexname): print(indexpath, subdir, indexname) @@ -111,8 +113,8 @@ def handleOneIndex(indexpath, subdir, indexname): textnum = nexttextnum modelnum += 1 modeldir = os.path.join(config.getModelDir(), subdir, indexname) - modelfile = os.path.join(modeldir, \ - config.getCandidateModelName(modelnum)) + modelfile = os.path.join( \ + modeldir, config.getCandidateModelName(modelnum)) reportfile = modelfile + config.getReportPostfix() if os.access(modelfile, os.F_OK): os.unlink(modelfile) @@ -129,6 +131,7 @@ def handleOneIndex(indexpath, subdir, indexname): utils.sign_epoch(indexstatus, 'Generate') utils.store_status(indexstatuspath, indexstatus) + def walkThroughIndex(path): for root, dirs, files in os.walk(path, topdown=True, onerror=handleError): for onefile in files: |