Skip to content

Commit

Permalink
Merge pull request #197 from twenty-three-23/feature/TT-236
Browse files Browse the repository at this point in the history
!TT-236 문장 생성이 안되는 버그
  • Loading branch information
snacktime81 authored Jul 12, 2024
2 parents 5af1620 + 9091746 commit 625677c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.time.LocalTime;

@Slf4j
@Entity
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down Expand Up @@ -40,7 +43,11 @@ public class SentenceEntity extends BaseCreatedAtEntity {
private LocalTime sentenceRealTime;

private SentenceEntity(ScriptEntity scriptEntity, Long paragraphId, String sentenceContent, Long sentenceOrder, LocalTime time){
if(scriptEntity.getDType() == InputAndSttType.INPUT){
this.scriptEntity = scriptEntity;
this.paragraphId = paragraphId;
this.sentenceContent = sentenceContent;
this.sentenceOrder = sentenceOrder;
if(scriptEntity.getDType() == InputAndSttType.INPUT) {
this.sentenceExpectTime = time;
} else if(scriptEntity.getDType() == InputAndSttType.STT){
this.sentenceRealTime = time;
Expand All @@ -55,6 +62,7 @@ public static SentenceEntity ofCreateInputSentence(ScriptEntity scriptEntity,
if(scriptEntity.getDType() != InputAndSttType.INPUT) {
throw new IllegalArgumentException("팩토리얼 함수를 잘못 사용했습니다.");
}
log.info("여기까지는 됨 {}", paragraphId);
return new SentenceEntity(scriptEntity, paragraphId, sentenceContent, sentenceOrder, sentenceExpectTime);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.twentythree.peech.script.dto.paragraphIdToExpectedTime;
import com.twentythree.peech.script.repository.SentenceRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand All @@ -32,10 +33,10 @@ public List<Long> saveInputSentencesByParagraphs(ScriptEntity scriptEntity, Stri
for (int paragraphId = 0; paragraphId < paragraphs.length; paragraphId++) {
String paragraph = paragraphs[paragraphId];

String[] sentences = paragraph.split(".");

String[] sentences = paragraph.split("\\.\\s*");
for (int sentenceOrder = 0; sentenceOrder < sentences.length; sentenceOrder++) {
String sentence = sentences[sentenceOrder];

String sentence = sentences[sentenceOrder]+".";
LocalTime expectedTime = ScriptUtils.calculateExpectedTime(sentence);
SentenceEntity sentenceEntity = sentenceRepository.save(SentenceEntity.ofCreateInputSentence(scriptEntity, (long) paragraphId, sentence, (long) sentenceOrder, expectedTime));
sentenceIds.add(sentenceEntity.getSentenceId());
Expand Down

0 comments on commit 625677c

Please sign in to comment.