Add homonphone replacer example for Python API. (#2161)
This commit is contained in:
@@ -123,6 +123,27 @@ def get_args():
|
||||
""",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--hr-dict-dir",
|
||||
type=str,
|
||||
default="",
|
||||
help="If not empty, it is the jieba dict directory for homophone replacer",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--hr-lexicon",
|
||||
type=str,
|
||||
default="",
|
||||
help="If not empty, it is the lexicon.txt for homophone replacer",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--hr-rule-fsts",
|
||||
type=str,
|
||||
default="",
|
||||
help="If not empty, it is the replace.fst for homophone replacer",
|
||||
)
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@@ -148,6 +169,9 @@ def create_recognizer(args):
|
||||
hotwords_file=args.hotwords_file,
|
||||
hotwords_score=args.hotwords_score,
|
||||
blank_penalty=args.blank_penalty,
|
||||
hr_dict_dir=args.hr_dict_dir,
|
||||
hr_rule_fsts=args.hr_rule_fsts,
|
||||
hr_lexicon=args.hr_lexicon,
|
||||
)
|
||||
return recognizer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user