Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process_tuv(tuv) causes IndexError #5

Open
Aariciah opened this issue Jan 16, 2024 · 0 comments
Open

process_tuv(tuv) causes IndexError #5

Aariciah opened this issue Jan 16, 2024 · 0 comments

Comments

@Aariciah
Copy link

Aariciah commented Jan 16, 2024

Hi, I just tried to read a file using

from tmx2dataframe import tmx2dataframe
metadata, df = tmx2dataframe.read("de-en.tmx")

and it gave me the following error:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In [2], line 2
      1 from tmx2dataframe import tmx2dataframe
----> 2 metadata, df = tmx2dataframe.read("de-en.tmx")

File ~/Library/Python/3.10/lib/python/site-packages/tmx2dataframe/tmx2dataframe.py:46, in read(path)
     44     count_unpaired = count_unpaired + 1
     45 else:
---> 46     srclang, srcsentence = process_tuv(tu.getElementsByTagName('tuv')[0])
     47     targetlang, targetsentence = process_tuv(tu.getElementsByTagName('tuv')[1])
     48     item = {
     49         'source_language': srclang,
     50         'source_sentence': srcsentence,
     51         'target_language': targetlang,
     52         'target_sentence': targetsentence
     53     }

File ~/Library/Python/3.10/lib/python/site-packages/tmx2dataframe/tmx2dataframe.py:10, in process_tuv(tuv)
      8     lang = tuv.getAttribute("xml:lang")
      9 seg = tuv.getElementsByTagName('seg')[0]
---> 10 txt = seg.childNodes[0].data
     11 return lang, txt

IndexError: list index out of range

This repo seems a little dead but it would be great if someone knew what is going on! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant