forked from kakao-tech-campus-2nd-step3/Team29_BE
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83bde51
commit 3080d1d
Showing
1 changed file
with
11 additions
and
20 deletions.
There are no files selected for viewing
31 changes: 11 additions & 20 deletions
31
src/main/java/notai/stt/presentation/request/SttCallbackRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,29 @@ | ||
package notai.stt.presentation.request; | ||
|
||
import notai.stt.application.command.UpdateSttResultCommand; | ||
import notai.stt.application.command.UpdateSttResultCommand.Word; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
public record SttCallbackRequest( | ||
String taskId, | ||
String state, | ||
SttResult result | ||
String text, | ||
List<Word> words | ||
) { | ||
public UpdateSttResultCommand toCommand() { | ||
List<Word> words = result.words().stream() | ||
.map(word -> new Word( | ||
List<UpdateSttResultCommand.Word> commandWords = words().stream() | ||
.map(word -> new UpdateSttResultCommand.Word( | ||
word.word(), | ||
word.start(), | ||
word.end() | ||
)) | ||
word.end())) | ||
.toList(); | ||
return new UpdateSttResultCommand(UUID.fromString(taskId), words); | ||
return new UpdateSttResultCommand(UUID.fromString(taskId), commandWords); | ||
} | ||
|
||
public record SttResult( | ||
double audioLength, | ||
String language, | ||
double languageProbability, | ||
String text, | ||
List<Word> words | ||
|
||
public record Word( | ||
String word, | ||
double start, | ||
double end | ||
) { | ||
public record Word( | ||
double start, | ||
double end, | ||
String word | ||
) {} | ||
} | ||
} |