소스 검색

过滤字幕中不重要的标点

vodkazi 1 개월 전
부모
커밋
073d1f39d6
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      packages/templates/src/base/components/subtitle-bar.tsx

+ 3 - 1
packages/templates/src/base/components/subtitle-bar.tsx

@@ -106,7 +106,9 @@ export const SubtitleBar: React.FC<SubtitleBarProps> = ({
             overflow: "hidden",
           }}
         >
-          {currentSegment.words.map((w, i) => {
+          {currentSegment.words
+            .filter((w) => !/[。,!?\s]/.test(w.word))
+            .map((w, i) => {
             const isCurrent = i === currentWordIndex;
             const isPast = currentTime > w.endSeconds;
             return (