Add Swift example for generating subtitles (#318)

This commit is contained in:
Fangjun Kuang
2023-09-18 15:16:54 +08:00
committed by GitHub
parent 2d51ca49b7
commit 692a47dd80
9 changed files with 654 additions and 11 deletions

View File

@@ -18,9 +18,9 @@ void Hypotheses::Add(Hypothesis hyp) {
} else {
it->second.log_prob = LogAdd<double>()(it->second.log_prob, hyp.log_prob);
if (it->second.lm_log_prob != 0 && hyp.lm_log_prob != 0){
if (it->second.lm_log_prob != 0 && hyp.lm_log_prob != 0) {
it->second.lm_log_prob =
LogAdd<double>()(it->second.lm_log_prob, hyp.lm_log_prob);
LogAdd<double>()(it->second.lm_log_prob, hyp.lm_log_prob);
}
}
}

View File

@@ -15,7 +15,7 @@ struct SileroVadModelConfig {
// threshold to classify a segment as speech
//
// The predicted probability of a segment is larger than this
// If the predicted probability of a segment is larger than this
// value, then it is classified as speech.
float threshold = 0.5;
@@ -25,7 +25,7 @@ struct SileroVadModelConfig {
// 512, 1024, 1536 samples for 16000 Hz
// 256, 512, 768 samples for 800 Hz
int window_size = 512; // in samples
int32_t window_size = 512; // in samples
SileroVadModelConfig() = default;