lyrics-transcriber 0.37.0__py3-none-any.whl → 0.40.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.
Files changed (29) hide show
  1. lyrics_transcriber/correction/handlers/extend_anchor.py +13 -2
  2. lyrics_transcriber/correction/handlers/word_operations.py +8 -2
  3. lyrics_transcriber/frontend/dist/assets/index-DKnNJHRK.js +26696 -0
  4. lyrics_transcriber/frontend/dist/assets/index-DKnNJHRK.js.map +1 -0
  5. lyrics_transcriber/frontend/dist/index.html +1 -1
  6. lyrics_transcriber/frontend/package.json +3 -2
  7. lyrics_transcriber/frontend/src/components/EditModal.tsx +1 -0
  8. lyrics_transcriber/frontend/src/components/LyricsAnalyzer.tsx +36 -13
  9. lyrics_transcriber/frontend/src/components/ReferenceView.tsx +41 -1
  10. lyrics_transcriber/frontend/src/components/ReviewChangesModal.tsx +48 -16
  11. lyrics_transcriber/frontend/src/components/TimelineEditor.tsx +71 -16
  12. lyrics_transcriber/frontend/src/components/TranscriptionView.tsx +11 -7
  13. lyrics_transcriber/frontend/src/components/shared/components/HighlightedText.tsx +45 -12
  14. lyrics_transcriber/frontend/src/components/shared/hooks/useWordClick.ts +83 -19
  15. lyrics_transcriber/frontend/src/components/shared/types.ts +3 -0
  16. lyrics_transcriber/frontend/src/components/shared/utils/initializeDataWithIds.tsx +65 -9
  17. lyrics_transcriber/frontend/vite.config.js +4 -0
  18. lyrics_transcriber/frontend/vite.config.ts +4 -0
  19. lyrics_transcriber/lyrics/genius.py +41 -12
  20. lyrics_transcriber/output/cdg.py +106 -29
  21. lyrics_transcriber/output/cdgmaker/composer.py +822 -528
  22. lyrics_transcriber/output/lrc_to_cdg.py +61 -0
  23. lyrics_transcriber/review/server.py +10 -12
  24. {lyrics_transcriber-0.37.0.dist-info → lyrics_transcriber-0.40.0.dist-info}/METADATA +3 -2
  25. {lyrics_transcriber-0.37.0.dist-info → lyrics_transcriber-0.40.0.dist-info}/RECORD +28 -26
  26. {lyrics_transcriber-0.37.0.dist-info → lyrics_transcriber-0.40.0.dist-info}/entry_points.txt +1 -0
  27. lyrics_transcriber/frontend/dist/assets/index-BNNbsbVN.js +0 -182
  28. {lyrics_transcriber-0.37.0.dist-info → lyrics_transcriber-0.40.0.dist-info}/LICENSE +0 -0
  29. {lyrics_transcriber-0.37.0.dist-info → lyrics_transcriber-0.40.0.dist-info}/WHEEL +0 -0
@@ -80,8 +80,19 @@ class ExtendAnchorHandler(GapCorrectionHandler):
80
80
  confidence = len(matching_sources) / len(gap.reference_words)
81
81
  sources = ", ".join(matching_sources)
82
82
 
83
- # Calculate reference positions for matching sources
84
- reference_positions = WordOperations.calculate_reference_positions(gap, matching_sources)
83
+ # Get base reference positions
84
+ base_reference_positions = WordOperations.calculate_reference_positions(gap, matching_sources)
85
+
86
+ # Adjust reference positions based on the word's position in the reference text
87
+ reference_positions = {}
88
+ for source in matching_sources:
89
+ if source in base_reference_positions:
90
+ # Find this word's position in the reference text
91
+ ref_words = gap.reference_words[source]
92
+ for ref_idx, ref_word in enumerate(ref_words):
93
+ if ref_word.lower() == word.lower():
94
+ reference_positions[source] = base_reference_positions[source] + ref_idx
95
+ break
85
96
 
86
97
  corrections.append(
87
98
  WordOperations.create_word_replacement_correction(
@@ -23,9 +23,15 @@ class WordOperations:
23
23
 
24
24
  for source in sources_to_check:
25
25
  if source in gap.preceding_anchor.reference_positions:
26
- # Calculate position based on anchor position and offset
26
+ # Calculate base position from anchor
27
27
  anchor_pos = gap.preceding_anchor.reference_positions[source]
28
- ref_pos = anchor_pos + len(gap.preceding_anchor.words)
28
+ base_ref_pos = anchor_pos + len(gap.preceding_anchor.words)
29
+
30
+ # Calculate word offset within the gap
31
+ word_offset = gap.words.index(gap.words[gap.transcription_position - gap.transcription_position])
32
+
33
+ # Add word offset to base position
34
+ ref_pos = base_ref_pos + word_offset
29
35
  reference_positions[source] = ref_pos
30
36
  return reference_positions
31
37