lyrics-transcriber 0.36.1__py3-none-any.whl → 0.37.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lyrics_transcriber/core/controller.py +22 -2
- lyrics_transcriber/correction/corrector.py +8 -8
- lyrics_transcriber/correction/handlers/base.py +4 -0
- lyrics_transcriber/correction/handlers/extend_anchor.py +9 -0
- lyrics_transcriber/correction/handlers/no_space_punct_match.py +21 -10
- lyrics_transcriber/correction/handlers/relaxed_word_count_match.py +21 -11
- lyrics_transcriber/correction/handlers/syllables_match.py +4 -4
- lyrics_transcriber/correction/handlers/word_count_match.py +19 -10
- lyrics_transcriber/frontend/dist/assets/index-BNNbsbVN.js +182 -0
- lyrics_transcriber/frontend/dist/index.html +1 -1
- lyrics_transcriber/frontend/src/components/CorrectionMetrics.tsx +1 -2
- lyrics_transcriber/frontend/src/components/DetailsModal.tsx +76 -70
- lyrics_transcriber/frontend/src/components/EditModal.tsx +10 -2
- lyrics_transcriber/frontend/src/components/LyricsAnalyzer.tsx +128 -125
- lyrics_transcriber/frontend/src/components/ReferenceView.tsx +1 -3
- lyrics_transcriber/frontend/src/components/ReviewChangesModal.tsx +24 -12
- lyrics_transcriber/frontend/src/components/TranscriptionView.tsx +8 -15
- lyrics_transcriber/frontend/src/components/WordEditControls.tsx +3 -3
- lyrics_transcriber/frontend/src/components/shared/components/HighlightedText.tsx +34 -52
- lyrics_transcriber/frontend/src/components/shared/hooks/useWordClick.ts +39 -31
- lyrics_transcriber/frontend/src/components/shared/types.ts +3 -3
- lyrics_transcriber/frontend/src/components/shared/utils/initializeDataWithIds.tsx +146 -0
- lyrics_transcriber/frontend/src/components/shared/utils/referenceLineCalculator.ts +23 -24
- lyrics_transcriber/frontend/src/types.ts +25 -15
- lyrics_transcriber/frontend/tsconfig.tsbuildinfo +1 -1
- lyrics_transcriber/output/cdg.py +32 -6
- lyrics_transcriber/output/video.py +17 -7
- lyrics_transcriber/review/server.py +24 -8
- {lyrics_transcriber-0.36.1.dist-info → lyrics_transcriber-0.37.0.dist-info}/METADATA +1 -1
- {lyrics_transcriber-0.36.1.dist-info → lyrics_transcriber-0.37.0.dist-info}/RECORD +33 -33
- {lyrics_transcriber-0.36.1.dist-info → lyrics_transcriber-0.37.0.dist-info}/entry_points.txt +1 -0
- lyrics_transcriber/frontend/dist/assets/index-ztlAYPYT.js +0 -181
- lyrics_transcriber/frontend/src/components/shared/utils/newlineCalculator.ts +0 -37
- {lyrics_transcriber-0.36.1.dist-info → lyrics_transcriber-0.37.0.dist-info}/LICENSE +0 -0
- {lyrics_transcriber-0.36.1.dist-info → lyrics_transcriber-0.37.0.dist-info}/WHEEL +0 -0
@@ -1,37 +0,0 @@
|
|
1
|
-
import { LyricsData, LyricsSegment } from '../../../types'
|
2
|
-
|
3
|
-
export function calculateNewlineIndices(
|
4
|
-
corrected_segments: LyricsSegment[],
|
5
|
-
anchors: LyricsData['anchor_sequences'],
|
6
|
-
currentSource: string
|
7
|
-
): Set<number> {
|
8
|
-
return new Set(
|
9
|
-
corrected_segments.slice(0, -1).map((segment, segmentIndex) => {
|
10
|
-
const segmentText = segment.text.trim()
|
11
|
-
const segmentWords = segmentText.split(/\s+/)
|
12
|
-
const segmentStartWord = corrected_segments
|
13
|
-
.slice(0, segmentIndex)
|
14
|
-
.reduce((acc, s) => acc + s.text.trim().split(/\s+/).length, 0)
|
15
|
-
const lastWordPosition = segmentStartWord + segmentWords.length - 1
|
16
|
-
|
17
|
-
const matchingAnchor = anchors.find(a => {
|
18
|
-
const start = a.transcription_position
|
19
|
-
const end = start + a.length - 1
|
20
|
-
return lastWordPosition >= start && lastWordPosition <= end
|
21
|
-
})
|
22
|
-
|
23
|
-
if (matchingAnchor?.reference_positions[currentSource] !== undefined) {
|
24
|
-
const anchorWords = matchingAnchor.words
|
25
|
-
const wordIndex = anchorWords.findIndex(w =>
|
26
|
-
w.toLowerCase() === segmentWords[segmentWords.length - 1].toLowerCase()
|
27
|
-
)
|
28
|
-
|
29
|
-
if (wordIndex !== -1) {
|
30
|
-
return matchingAnchor.reference_positions[currentSource] + wordIndex
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
return null
|
35
|
-
}).filter((pos): pos is number => pos !== null && pos >= 0)
|
36
|
-
)
|
37
|
-
}
|
File without changes
|
File without changes
|