Fix logs and recognition format
This commit is contained in:
@@ -3,7 +3,6 @@ package speechkit
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -150,10 +149,12 @@ func (s *SpeechKitService) GetRecognitionText(operationID string) (string, error
|
||||
}
|
||||
return "", fmt.Errorf("failed to receive recognition response: %w", err)
|
||||
}
|
||||
if final := resp.GetFinal(); final != nil {
|
||||
for _, alt := range final.Alternatives {
|
||||
sb.WriteString(alt.Text)
|
||||
sb.WriteString(" ")
|
||||
if refinement := resp.GetFinalRefinement(); refinement != nil {
|
||||
if text := refinement.GetNormalizedText(); text != nil {
|
||||
for _, alt := range text.Alternatives {
|
||||
sb.WriteString(alt.Text)
|
||||
sb.WriteString(" ")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,8 +169,6 @@ func (s *SpeechKitService) CheckOperationStatus(operationID string) (*operation.
|
||||
ctx = metadata.AppendToOutgoingContext(ctx, "authorization", "Api-Key "+s.apiKey)
|
||||
ctx = metadata.AppendToOutgoingContext(ctx, "x-folder-id", s.folderID)
|
||||
|
||||
log.Printf("Check operation status: id %s\n", operationID)
|
||||
|
||||
op, err := s.opClient.Get(ctx, &operation.GetOperationRequest{
|
||||
OperationId: operationID,
|
||||
})
|
||||
|
Reference in New Issue
Block a user