Skip to content

Commit

Permalink
fix: confidence algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobLinCool committed Jan 18, 2024
1 parent 1c723a8 commit f5f0ead
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-tables-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"smart-whisper": patch
---

Fix confidence algorithm
6 changes: 3 additions & 3 deletions src/binding/transcribe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ class TranscribeWorker : public Napi::AsyncProgressQueueWorker<int> {
max_p = std::max(max_p, token.p);
}

if (tokens > 2) {
confidence = (confidence - min_p - max_p) / (tokens - 2 - skips);
} else {
if (tokens - skips > 2) {
confidence = (confidence - min_p - max_p) / (tokens - skips - 2);
} else if (tokens - skips > 0) {
confidence = confidence / (tokens - skips);
}

Expand Down

0 comments on commit f5f0ead

Please sign in to comment.