doakey3 / Subsimport

Blender 3d addon for importing and editing subtitle and lyric files.
GNU General Public License v3.0
61 stars 15 forks source link

Syllabify error - out of index on remove punctuation #2

Closed JonatasAmaral closed 7 years ago

JonatasAmaral commented 7 years ago

When i try to sillabify my subtitles, i'm getting an error of out of index, being trowed by the remove_punctuation script. I am not an expert, but it looks to me, according to the part word[0] that it is happening when some recognized word is "empty". But i tried remove the empty lines of my .txt file (just in case the script was using it instead of the Blender's text strips), and it still getting this error

I using Portuguese (there is a lot of accentuation). Tried use the script in Us english, even the text being in Portuguese. The same.

And i just tied another project from zero to test. Text in english, US english set in the idiom dropdown. Works great.

Here's the console error:

Traceback (most recent call last):
  File "C:\Users\jonatas\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Subsimport-master\operators\syllabify.py", line 72, in execute
    words = collect_words(scene)
  File "C:\Users\jonatas\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Subsimport-master\operators\syllabify.py", line 33, in collect_words
    words[i] = remove_punctuation(words[i])
  File "C:\Users\jonatas\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Subsimport-master\operators\tools\remove_punctuation.py", line 8, in remove_punctuation
    while word[0] in puncs:
IndexError: string index out of range

location: <unknown location>:-1

location: <unknown location>:-1
JonatasAmaral commented 7 years ago

doing some tests, with a new small file, and got a different error:

screenshot

Traceback (most recent call last):
  File "C:\Users\jonatas\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Subsimport-master\operators\syllabify.py", line 89, in execute
    hyphenator.setup_patterns()
  File "C:\Users\jonatas\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Subsimport-master\operators\hyphenator\hyphenator.py", line 11, in setup_patterns
    self._insert_pattern(pattern)
  File "C:\Users\jonatas\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Subsimport-master\operators\hyphenator\hyphenator.py", line 22, in _insert_pattern
    points = [ int(d or 0) for d in re.split("[.a-z]", pattern) ]
  File "C:\Users\jonatas\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Subsimport-master\operators\hyphenator\hyphenator.py", line 22, in <listcomp>
    points = [ int(d or 0) for d in re.split("[.a-z]", pattern) ]
ValueError: invalid literal for int() with base 10: 'á'

location: <unknown location>:-1

location: <unknown location>:-1

Tried set the idiom to US english, with a portuguese text with accentuations and all those thing, and it works (in the Portuguese idiom it do not). But the main file that i'm working on still getting the first error.

doakey3 commented 7 years ago

Can you send me the lyrics file you are working with (portuguese is fine) that causes the problem. I'll try to tackle this in the next couple days.

JonatasAmaral commented 7 years ago

letra.txt - text with music's lyrics used to import into add-on letra.srt - SRT file exported by the add-on (it is as TXT because GitHub does'tn support upload SRT files. Just remove .txt from file name)

doakey3 commented 7 years ago

I've made an update that I think will fix the issue you were having. Thanks for contributing! Sorry I didn't get back to you sooner.

JonatasAmaral commented 7 years ago

No problem. I already did what i needed. I really don't NEEDED the "sillabification" right now. Just posted the issue to help improve the amazing add-on. Thanks for that.