|
@ -261,21 +261,21 @@ std::shared_ptr InitDecodeResourceFromFlags() { |
|
|
resource->post_processor = |
|
|
resource->post_processor = |
|
|
std::make_shared<PostProcessor>(std::move(post_process_opts)); |
|
|
std::make_shared<PostProcessor>(std::move(post_process_opts)); |
|
|
|
|
|
|
|
|
if (!FLAGS_itn_model_dir.empty()) { // With ITN |
|
|
|
|
|
std::string itn_tagger_path = |
|
|
|
|
|
wenet::JoinPath(FLAGS_itn_model_dir, "zh_itn_tagger.fst"); |
|
|
|
|
|
std::string itn_verbalizer_path = |
|
|
|
|
|
wenet::JoinPath(FLAGS_itn_model_dir, "zh_itn_verbalizer.fst"); |
|
|
|
|
|
if (wenet::FileExists(itn_tagger_path) && |
|
|
|
|
|
wenet::FileExists(itn_verbalizer_path)) { |
|
|
|
|
|
LOG(INFO) << "Reading ITN fst" << FLAGS_itn_model_dir; |
|
|
|
|
|
post_process_opts.itn = true; |
|
|
|
|
|
auto postprocessor = |
|
|
|
|
|
std::make_shared<wenet::PostProcessor>(std::move(post_process_opts)); |
|
|
|
|
|
postprocessor->InitITNResource(itn_tagger_path, itn_verbalizer_path); |
|
|
|
|
|
resource->post_processor = postprocessor; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// if (!FLAGS_itn_model_dir.empty()) { // With ITN |
|
|
|
|
|
// std::string itn_tagger_path = |
|
|
|
|
|
// wenet::JoinPath(FLAGS_itn_model_dir, "zh_itn_tagger.fst"); |
|
|
|
|
|
// std::string itn_verbalizer_path = |
|
|
|
|
|
// wenet::JoinPath(FLAGS_itn_model_dir, "zh_itn_verbalizer.fst"); |
|
|
|
|
|
// if (wenet::FileExists(itn_tagger_path) && |
|
|
|
|
|
// wenet::FileExists(itn_verbalizer_path)) { |
|
|
|
|
|
// LOG(INFO) << "Reading ITN fst" << FLAGS_itn_model_dir; |
|
|
|
|
|
// post_process_opts.itn = true; |
|
|
|
|
|
// auto postprocessor = |
|
|
|
|
|
// std::make_shared<wenet::PostProcessor>(std::move(post_process_opts)); |
|
|
|
|
|
// postprocessor->InitITNResource(itn_tagger_path, itn_verbalizer_path); |
|
|
|
|
|
// resource->post_processor = postprocessor; |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
return resource; |
|
|
return resource; |
|
|
} |
|
|
} |
|
|