enovales / LudumLinguarum

Tool for creating language learning flash cards from games.
MIT License
2 stars 0 forks source link

Generated export file is empty #49

Open chazmead3 opened 5 years ago

chazmead3 commented 5 years ago

Description

I was able to use the dump-text subcommand to get translated text, however when I used export-supermemo (and other export subcommands as well), the generated file was empty.

Repro steps

import and export as per the steps for the Super Memo Quick Start (with game Neverwinter Nights, English and Spanish.

Commands and first few lines of response (shown below) do not indicate a problem.

C:\Users\chazm\Desktop\Ludum>LudumLinguarum export-supermemo --game="Neverwinter Nights" --recognition-language=en --production-language=es --export-path="C:\Users\chazm\Desktop\Ludum\export\supermem.txt" Writing to [C:\Users\chazm\Desktop\Ludum\export\supermem.txt] Exporting lesson [2DA: actions] Exporting lesson [2DA: ambient music] Exporting lesson [2DA: ambient sound]

Expected behavior

The text file that is created should contain content.

Actual behavior

The output file is created but empty.

Known workarounds

Here is successful dump-text with both english and spanish (verifying both languages were imported): C:\Users\chazm\Desktop\Ludum>LudumLinguarum dump-text --game="Neverwinter Nights" --lesson-filter-regex="2DA: traps" Spike Trap, Minor Trampa de estacas menor Spike Trap, Average Trampa de estacas corriente

I copied and modified this output to successfully make a Super Memo deck.

Related information

I'm using latest release 1.1.2 from Dec 28, 2018 located here: https://github.com/enovales/LudumLinguarum/releases

chazmead3 commented 5 years ago

The underlying issue encountered was that during import, the KeyHash values were different for the 2 languages (English & Spanish). I ran the import once for each language sequentially, switching out the installed language in the game. Apparently with different executions, different hashes are generated for the same key.

Mismatched hash values explains why the output file was empty - since during export Ludum couldn't find any matches. I was able to resolve the issue with a SQL query in the DB to update the KeyHash values for the Spanish entries in the CardEntry table to match the KeyHash values for English. Once I did this, I could export normally.

I tried another single language game - KOTOR2, and got the same result of different KeyHash values between the languages when importing them sequentially. Perhaps there is a way to upgrade the routine that creates the hashes to consistently generate the same result for a given key?

enovales commented 5 years ago

Ugh, I may have broken this at some point, as I think these were some of the first (if not the first) games I implemented. I seem to remember that I took some care to generate the hashes based on the index in the talk table for the strings, but maybe that got overridden or changed to just be based on the contents of the strings. I'll look into this - sorry for the bad experience out of the box here!