-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support adding punctuations to the speech recogntion result (#761)
- Loading branch information
1 parent
0f4705f
commit 329fe1a
Showing
27 changed files
with
866 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
log() { | ||
# This function is from espnet | ||
local fname=${BASH_SOURCE[1]##*/} | ||
echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*" | ||
} | ||
|
||
echo "EXE is $EXE" | ||
echo "PATH: $PATH" | ||
|
||
which $EXE | ||
|
||
log "------------------------------------------------------------" | ||
log "Download model " | ||
log "------------------------------------------------------------" | ||
|
||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
tar xvf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
repo=sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12 | ||
ls -lh $repo | ||
|
||
$EXE \ | ||
--debug=1 \ | ||
--ct-transformer=$repo/model.onnx \ | ||
"这是一个测试你好吗How are you我很好thank you are you ok谢谢你" | ||
|
||
$EXE \ | ||
--debug=1 \ | ||
--ct-transformer=$repo/model.onnx \ | ||
"我们都是木头人不会说话不会动" | ||
|
||
$EXE \ | ||
--debug=1 \ | ||
--ct-transformer=$repo/model.onnx \ | ||
"The African blogosphere is rapidly expanding bringing more voices online in the form of commentaries opinions analyses rants and poetry" | ||
|
||
rm -rf $repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// sherpa-onnx/csrc/offline-ct-transformer-model-meta_data.h | ||
// | ||
// Copyright (c) 2024 Xiaomi Corporation | ||
#ifndef SHERPA_ONNX_CSRC_OFFLINE_CT_TRANSFORMER_MODEL_META_DATA_H_ | ||
#define SHERPA_ONNX_CSRC_OFFLINE_CT_TRANSFORMER_MODEL_META_DATA_H_ | ||
|
||
#include <string> | ||
#include <unordered_map> | ||
#include <vector> | ||
|
||
namespace sherpa_onnx { | ||
|
||
struct OfflineCtTransformerModelMetaData { | ||
std::unordered_map<std::string, int32_t> token2id; | ||
std::unordered_map<std::string, int32_t> punct2id; | ||
std::vector<std::string> id2punct; | ||
|
||
int32_t unk_id; | ||
int32_t dot_id; | ||
int32_t comma_id; | ||
int32_t quest_id; | ||
int32_t pause_id; | ||
int32_t underline_id; | ||
int32_t num_punctuations; | ||
}; | ||
|
||
} // namespace sherpa_onnx | ||
|
||
#endif // SHERPA_ONNX_CSRC_OFFLINE_CT_TRANSFORMER_MODEL_META_DATA_H_ |
Oops, something went wrong.