正在显示
2 个修改的文件
包含
6 行增加
和
0 行删除
| @@ -274,6 +274,10 @@ class KokoroMultiLangLexicon::Impl { | @@ -274,6 +274,10 @@ class KokoroMultiLangLexicon::Impl { | ||
| 274 | 274 | ||
| 275 | std::vector<std::vector<int32_t>> ConvertNonChineseToTokenIDs( | 275 | std::vector<std::vector<int32_t>> ConvertNonChineseToTokenIDs( |
| 276 | const std::string &text, const std::string &voice) const { | 276 | const std::string &text, const std::string &voice) const { |
| 277 | + if (IsPunctuation(text)) { | ||
| 278 | + return {std::vector<int32_t>{0, token2id_.at(text), 0}}; | ||
| 279 | + } | ||
| 280 | + | ||
| 277 | if (!voice.empty()) { | 281 | if (!voice.empty()) { |
| 278 | return ConvertTextToTokenIDsWithEspeak(text, voice); | 282 | return ConvertTextToTokenIDsWithEspeak(text, voice); |
| 279 | } | 283 | } |
| @@ -5,6 +5,8 @@ Please download test files used in this script from | @@ -5,6 +5,8 @@ Please download test files used in this script from | ||
| 5 | 5 | ||
| 6 | https://github.com/k2-fsa/sherpa-onnx/releases/tag/speaker-recongition-models | 6 | https://github.com/k2-fsa/sherpa-onnx/releases/tag/speaker-recongition-models |
| 7 | */ | 7 | */ |
| 8 | +import Foundation | ||
| 9 | + | ||
| 8 | func cosineSimilarity(_ a: [Float], _ b: [Float]) -> Float { | 10 | func cosineSimilarity(_ a: [Float], _ b: [Float]) -> Float { |
| 9 | precondition(a.count == b.count, "Vectors must have the same length") | 11 | precondition(a.count == b.count, "Vectors must have the same length") |
| 10 | 12 |
-
请 注册 或 登录 后发表评论