diff options
-rw-r--r-- | lib/myconfig.py | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | reduce.py | 11 |
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/myconfig.py b/lib/myconfig.py index 29d7ae3..e1dc5b6 100644 --- a/lib/myconfig.py +++ b/lib/myconfig.py @@ -41,7 +41,7 @@ class MyConfig: return m_trainer_dir + os.sep + 'finals' #about 1,200 Chinese characters - m_minimum_chinese_characters = 1,200 + m_minimum_chinese_characters = 1200 m_minimum_file_size = m_minimum_chinese_characters * 3 + \ m_minimum_chinese_characters / 2 @@ -62,7 +62,7 @@ class MyConfig: m_index_postfix = '.index' def getIndexPostfix(self): - return m_index_postfix + return self.m_index_postfix m_text_postfix = '.text' diff --git a/reduce.py b/reduce.py index 1aa0f39..96ed368 100644..100755 --- a/reduce.py +++ b/reduce.py @@ -2,6 +2,7 @@ import os import os.path import sys +from argparse import ArgumentParser from myconfig import MyConfig @@ -45,6 +46,12 @@ def iterateSubDirectory(oldroot, newroot, level): iterateSubDirectory(olddir, newdir, level - 1) -#test case if __name__ == '__main__': - pass + parser = ArgumentParser(description='Reduce the categories.') + parser.add_argument('--level', action='store', nargs=1, default=2) + parser.add_argument('origdir', action='store') + parser.add_argument('destdir', action='store') + + args = parser.parse_args() + iterateSubDirectory(args.origdir, args.destdir, int(args.level[0])) + print('done') |