-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from twenty-three-23/feature/TT-268-fix-stt-p…
…rocess
- Loading branch information
Showing
10 changed files
with
121 additions
and
172 deletions.
There are no files selected for viewing
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
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
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
20 changes: 0 additions & 20 deletions
20
src/main/java/com/twentythree/peech/script/stt/dto/response/STTResultResponseDto.java
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
src/main/java/com/twentythree/peech/script/stt/dto/response/STTResultResponseVO.java
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
src/main/java/com/twentythree/peech/script/stt/service/AddRealTimeToSentenceService.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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.twentythree.peech.script.stt.service; | ||
|
||
import com.twentythree.peech.script.stt.dto.AddSentenceInformationVO; | ||
import com.twentythree.peech.script.stt.dto.response.ClovaResponseDto; | ||
import com.twentythree.peech.script.stt.dto.response.ParagraphDivideResponseDto; | ||
import com.twentythree.peech.script.stt.utils.MergeWordListUtils; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class AddRealTimeToSentenceService { | ||
public List<AddSentenceInformationVO> addRealTimeToSentence(ClovaResponseDto clovaResponseDto, ParagraphDivideResponseDto paragraphDivideResponseDto) { | ||
|
||
// AddSentenceInformationVO 객체 리스트를 만들어야 함 | ||
List<AddSentenceInformationVO> AddSentenceInformationVOList = new ArrayList<>(); | ||
|
||
// 문단 나누기 결과 가져오기 | ||
List<String> sentenceList = paragraphDivideResponseDto.getResult().getParagraphList().stream().flatMap(List::stream).toList(); | ||
|
||
// clovaResponseDto에서 wordList 가져오기 | ||
List<List<Object>> wordList = MergeWordListUtils.mergeWordList(clovaResponseDto); | ||
|
||
int startIndex = 0; | ||
int endIndex = 0; | ||
int startStamp = 0; | ||
int endStamp = 0; | ||
long sentenceOrder = 0L; | ||
|
||
// 문장의 단어 개수를 기반으로 문장의 시작 시간과 종료 시간을 계산 | ||
for(String sentence : sentenceList){ | ||
startStamp = (int) wordList.get(startIndex).get(0); | ||
// 해당 문장의 단어 개수를 알아야함 | ||
int wordCount = sentence.split(" ").length; | ||
endIndex = startIndex + wordCount - 1; | ||
endStamp = (int) wordList.get(endIndex).get(1); | ||
int duration = endStamp - startStamp; | ||
|
||
AddSentenceInformationVO AddSentenceInformationVO = new AddSentenceInformationVO(++sentenceOrder, sentence, duration); | ||
AddSentenceInformationVOList.add(AddSentenceInformationVO); | ||
startIndex = endIndex + 1; | ||
} | ||
|
||
return AddSentenceInformationVOList; | ||
} | ||
} |
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
55 changes: 0 additions & 55 deletions
55
src/main/java/com/twentythree/peech/script/stt/service/EditClovaSpeechResponseService.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.