LuteOrg / lute-v3

LUTE = Learning Using Texts: learn languages through reading.
https://luteorg.github.io/lute-manual/
MIT License
487 stars 46 forks source link

Text imports mix up lines #23

Closed Mycheze closed 11 months ago

Mycheze commented 11 months ago

Description

I've noticed that some lines (not very common, but some) are out of order from the original text file that was imported. I noticed this while listening along with an audiobook and certain things would be skipped then gone back to in a few moments. It's not an issue with the next file (see attachments).

To Reproduce

Steps to reproduce the behavior, e.g.:

  1. Import using a text file
  2. Notice that some lines are out of order

Screenshots

This is the text I confirmed with. Harry Potter a Fenixuv rad - J. K. Rowling.txt. An example of a line that is out of place is S mou drahou starou matičkou, ano which is on line 1889.

Here it is in Lute out of order: lutemixingupsomelines lutemixingupsomelines2

Extra software info, if not already included in the Description:

jzohrab commented 11 months ago

Thanks, checked and fixed on v3.0.0. This is a render-time problem, not import, the import works and doesn't mix up sentences.

Summary of the bug, fyi: at render time, the code parses the current text, and gets the paragraph numbers to write out. The line paranums = unique([t.paragraph_number for t in tokens]) uses python's unique function, but that wasn't preserving the order. Oddly it has never occurred for me till now! With paranums = sorted(unique([t.paragraph_number for t in tokens])) the numbers are sorted.

I'll make a release soon as this needs to be resolved. Thanks!

jzohrab commented 11 months ago

Fixed in 3.0.1, launched, thanks!