Skip to content

Commit

Permalink
句読点のテストを追加する
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexa committed Dec 20, 2024
1 parent 7e5750e commit d564323
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions amazon_transcribe_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,40 @@ func TestBuildMessage(t *testing.T) {
Ok: false,
},
},
{
Name: "punctuation",
Config: Config{
MinimumTranscribedTime: 0.01,
MinimumConfidenceScore: 0,
},
Input: Input{
Alt: transcribestreamingservice.Alternative{
Items: []*transcribestreamingservice.Item{
{
StartTime: aws.Float64(1.00),
EndTime: aws.Float64(1.02),
Content: aws.String("テスト"),
},
{
// 句読点は StartTime と EndTime が同じ
StartTime: aws.Float64(1.02),
EndTime: aws.Float64(1.02),
Content: aws.String("、"),
},
{
StartTime: aws.Float64(1.02),
EndTime: aws.Float64(1.04),
Content: aws.String("データ"),
},
},
},
IsPartial: false,
},
Expect: Expect{
Message: "テスト、データ",
Ok: true,
},
},
}

for _, tc := range testCases {
Expand Down Expand Up @@ -309,6 +343,43 @@ func TestBuildMessage(t *testing.T) {
Ok: false,
},
},
{
Name: "punctuation",
Config: Config{
MinimumConfidenceScore: 0.1,
MinimumTranscribedTime: 0,
},
Input: Input{
Alt: transcribestreamingservice.Alternative{
Items: []*transcribestreamingservice.Item{
{
Confidence: aws.Float64(0.2),
StartTime: aws.Float64(1.0),
EndTime: aws.Float64(1.02),
Content: aws.String("テスト"),
},
{
// 句読点は Confidence は nil
Confidence: nil,
StartTime: aws.Float64(1.02),
EndTime: aws.Float64(1.02),
Content: aws.String("、"),
},
{
Confidence: aws.Float64(0.2),
StartTime: aws.Float64(1.02),
EndTime: aws.Float64(1.04),
Content: aws.String("データ"),
},
},
},
IsPartial: false,
},
Expect: Expect{
Message: "テスト、データ",
Ok: true,
},
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit d564323

Please sign in to comment.