Skip to content

Commit

Permalink
fix(tn/itn): add cache_dir for cli (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingchensong authored Oct 30, 2023
1 parent 94c3eb2 commit be9aa9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion itn/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('--text', help='input string')
parser.add_argument('--file', help='input file path')
parser.add_argument('--cache_dir', type=str,
default=None,
help='cache dir containing *.fst')
parser.add_argument('--overwrite_cache', action='store_true',
help='rebuild *.fst')
parser.add_argument('--enable_standalone_number', type=str,
Expand All @@ -41,7 +44,7 @@ def main():
args = parser.parse_args()

normalizer = InverseNormalizer(
cache_dir='itn', overwrite_cache=args.overwrite_cache,
cache_dir=args.cache_dir, overwrite_cache=args.overwrite_cache,
enable_standalone_number=str2bool(args.enable_standalone_number),
enable_0_to_9=str2bool(args.enable_0_to_9))

Expand Down
5 changes: 4 additions & 1 deletion tn/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('--text', help='input string')
parser.add_argument('--file', help='input file path')
parser.add_argument('--cache_dir', type=str,
default=None,
help='cache dir containing *.fst')
parser.add_argument('--overwrite_cache', action='store_true',
help='rebuild *.fst')
args = parser.parse_args()

normalizer = Normalizer(cache_dir='tn',
normalizer = Normalizer(cache_dir=args.cache_dir,
overwrite_cache=args.overwrite_cache)

if args.text:
Expand Down

0 comments on commit be9aa9c

Please sign in to comment.