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

fixed an item-lost bug when exporting to textgrid #814

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

fncokg
Copy link
Contributor

@fncokg fncokg commented Jun 4, 2024

There is a item-lost bug in the previous version, which will make every file to lose its first phone and word item in the exported textgrid file.

Problem

In function construct_textgrid_output of file textgrid.py, the while True loop ends with this:

word_data = []
phone_data = []
utterance_data = []

These codes empty the three lists, while they are not empty because of these lines:

phone_data = [(pi_begin, pi_end, phone, pi_speaker_name)]

word_data = [(wi_begin, wi_end, word, wi_speaker_name)]

utterance_data = [(u_begin, u_end, text, u_speaker_name)]

Emptying them at the ending of a loop will cause a direct data discard.

Solution

I removed the three lines first, and to avoid the loop becomes an infinite loop, in this if block:

if phone_data:
process_phone_data()
current_file_id = pi_current_file_id
else:
break

I added a:

phone_data = []

These codes were tested and worked well now.

@mmcauliffe mmcauliffe merged commit 945424c into MontrealCorpusTools:main Jun 4, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants