Skip to content

Commit

Permalink
- 設定に minimum_confidence_score, minimum_transcribed_time を追加する
Browse files Browse the repository at this point in the history
- MinimumTranscribedTime の指定を秒に変更する
  • Loading branch information
Hexa committed Dec 17, 2024
1 parent 7409fb4 commit dfd659e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@

## develop

- [ADD] 採用する結果の信頼スコアの最小値を指定する minimum_confidence_score を追加する
- デフォルト値: 0(信頼スコアを無視する)
- @Hexa
- [ADD] 採用する結果の最小発話期間(秒)を指定する minimum_transcribed_time を追加する
- デフォルト値: 0(最小発話期間を無視する)
- @Hexa

### misc

## 2024.7.0
Expand Down
4 changes: 2 additions & 2 deletions amazon_transcribe_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (h *AmazonTranscribeHandler) Handle(ctx context.Context, opusCh chan opusCh

func buildMessage(config Config, alt transcribestreamingservice.Alternative, isPartial bool) (string, bool) {
minimumConfidenceScore := config.MinimumConfidenceScore
minimumTranscribedTimeMs := config.MinimumTranscribedTimeMs
minimumTranscribedTime := config.MinimumTranscribedTime

var message string
if minimumConfidenceScore > 0 {
Expand All @@ -222,7 +222,7 @@ func buildMessage(config Config, alt transcribestreamingservice.Alternative, isP

if (item.StartTime != nil) && (item.EndTime != nil) {
if (*item.EndTime - *item.StartTime) > 0 {
if (*item.EndTime - *item.StartTime) < minimumTranscribedTimeMs {
if (*item.EndTime - *item.StartTime) < minimumTranscribedTime {
// 発話時間が短い場合は次へ
continue
}
Expand Down
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ type Config struct {
// aws の場合は IsPartial が false, gcp の場合は IsFinal が true の場合にのみ結果を返す指定
FinalResultOnly bool `ini:"final_result_only"`

MinimumConfidenceScore float64 `ini:"minimum_confidence_score"`
MinimumTranscribedTimeMs float64 `ini:"minimum_transcribed_time_ms"`
MinimumConfidenceScore float64 `ini:"minimum_confidence_score"`
MinimumTranscribedTime float64 `ini:"minimum_transcribed_time"`

// Amazon Web Services
AwsCredentialFile string `ini:"aws_credential_file"`
Expand Down
6 changes: 6 additions & 0 deletions config_example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ retry_interval_ms = 100
# aws の場合は IsPartial が false, gcp の場合は IsFinal が true の場合の最終的な結果のみを返す指定
final_result_only = true

# 採用する結果の信頼スコアの最小値です
# minimum_confidence_score = 0.0

# 採用する結果の最小発話期間(秒)です
# minimum_transcribed_time = 0.0

# [aws]
aws_region = ap-northeast-1
# Partial-result stabilization の有効化です
Expand Down

0 comments on commit dfd659e

Please sign in to comment.