summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-01-16 13:30:30 +0800
committerPeng Wu <alexepico@gmail.com>2013-01-16 13:30:30 +0800
commitddf1253172d6c3ba7144f145b145f611c245cd15 (patch)
treeec480cf88285ba0cc2336a52ce4b040756b80a97
parentb68763cc73d772593aa396f9b85ebace32e91779 (diff)
downloadtrainer-ddf1253172d6c3ba7144f145b145f611c245cd15.zip
trainer-ddf1253172d6c3ba7144f145b145f611c245cd15.tar.gz
trainer-ddf1253172d6c3ba7144f145b145f611c245cd15.tar.xz
use getTextIndexDir
-rwxr-xr-xgenerate.py2
-rw-r--r--lib/myconfig.py3
-rw-r--r--partialwordthreshold.py2
-rw-r--r--populate.py2
-rw-r--r--populatebigram.py2
-rw-r--r--prepare.py2
-rwxr-xr-xreduce.py2
-rwxr-xr-xsegment.py2
8 files changed, 10 insertions, 7 deletions
diff --git a/generate.py b/generate.py
index 069cfec..520dba8 100755
--- a/generate.py
+++ b/generate.py
@@ -205,7 +205,7 @@ if __name__ == '__main__':
parser = ArgumentParser(description='Generate model candidates.')
parser.add_argument('--indexdir', action='store', \
help='index directory', \
- default=os.path.join(config.getTextDir(), 'index'))
+ default=config.getTextIndexDir())
parser.add_argument('--fast', action='store_const', \
help='Use in-memory filesystem to speed up generate', \
diff --git a/lib/myconfig.py b/lib/myconfig.py
index df9c746..3d55e8c 100644
--- a/lib/myconfig.py
+++ b/lib/myconfig.py
@@ -27,6 +27,9 @@ class MyConfig:
def getTextDir(self):
return self.m_trainer_dir + os.sep + 'texts'
+ def getTextIndexDir(self):
+ return self.m_trainer_dir + os.sep + 'texts' + os.sep + 'index'
+
def getModelDir(self):
return self.m_trainer_dir + os.sep + 'models'
diff --git a/partialwordthreshold.py b/partialwordthreshold.py
index da1daa0..69c2043 100644
--- a/partialwordthreshold.py
+++ b/partialwordthreshold.py
@@ -99,7 +99,7 @@ if __name__ == '__main__':
parser = ArgumentParser(description='Partial word threshold.')
parser.add_argument('--indexdir', action = 'store', \
help='index directory', \
- default=os.path.join(config.getTextDir(), 'index'))
+ default=config.getTextIndexDir())
args = parser.parse_args()
print(args)
diff --git a/populate.py b/populate.py
index 4d416db..ab06ed0 100644
--- a/populate.py
+++ b/populate.py
@@ -155,7 +155,7 @@ if __name__ == '__main__':
parser = ArgumentParser(description='Populate n-gram.')
parser.add_argument('--indexdir', action='store', \
help='index directory', \
- default=os.path.join(config.getTextDir(), 'index'))
+ default=config.getTextIndexDir())
parser.add_argument('--fast', action='store_const', \
help='Use /dev/shm to speed up populate', \
diff --git a/populatebigram.py b/populatebigram.py
index a71fe72..0ce6402 100644
--- a/populatebigram.py
+++ b/populatebigram.py
@@ -116,7 +116,7 @@ if __name__ == '__main__':
parser = ArgumentParser(description='Populate bi-gram.')
parser.add_argument('--indexdir', action='store', \
help='index directory', \
- default=os.path.join(config.getTextDir(), 'index'))
+ default=config.getTextIndexDir())
args = parser.parse_args()
print(args)
diff --git a/prepare.py b/prepare.py
index 5322bf4..b0d7b62 100644
--- a/prepare.py
+++ b/prepare.py
@@ -85,7 +85,7 @@ if __name__ == '__main__':
parser = ArgumentParser(description='Prepare word recognizer.')
parser.add_argument('--indexdir', action='store', \
help='index directory', \
- default=os.path.join(config.getTextDir(), 'index'))
+ default=config.getTextIndexDir())
args = parser.parse_args()
print(args)
diff --git a/reduce.py b/reduce.py
index 6c12519..0aed817 100755
--- a/reduce.py
+++ b/reduce.py
@@ -53,7 +53,7 @@ if __name__ == '__main__':
help='original index directory')
parser.add_argument('--destdir', action='store', \
help='reduced index directory', \
- default=os.path.join(config.getTextDir(), 'index'))
+ default=config.getTextIndexDir())
args = parser.parse_args()
print(args)
diff --git a/segment.py b/segment.py
index b2c81cb..7992eb0 100755
--- a/segment.py
+++ b/segment.py
@@ -97,7 +97,7 @@ if __name__ == '__main__':
parser = ArgumentParser(description='Segment all raw corpus documents.')
parser.add_argument('--indexdir', action='store', \
help='index directory', \
- default=os.path.join(config.getTextDir(), 'index'))
+ default=config.getTextIndexDir())
parser.add_argument('--fast', action='store_const', \
help='Use spseg to speed up segment', \