Closed fncokg closed 1 month ago
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.
In function construct_textgrid_output of file textgrid.py, the while True loop ends with this:
construct_textgrid_output
textgrid.py
while True
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/76c46a197f7f7d827f33c36bfe0088568294ecc6/montreal_forced_aligner/textgrid.py#L420-L422
These codes empty the three lists, while they are not empty because of these lines:
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/76c46a197f7f7d827f33c36bfe0088568294ecc6/montreal_forced_aligner/textgrid.py#L377
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/76c46a197f7f7d827f33c36bfe0088568294ecc6/montreal_forced_aligner/textgrid.py#L393
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/76c46a197f7f7d827f33c36bfe0088568294ecc6/montreal_forced_aligner/textgrid.py#L406
Emptying them at the ending of a loop will cause a direct data discard.
I removed the three lines first, and to avoid the loop becomes an infinite loop, in this if block:
if
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/76c46a197f7f7d827f33c36bfe0088568294ecc6/montreal_forced_aligner/textgrid.py#L383-L387
I added a:
phone_data = []
These codes were tested and worked well now.
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 filetextgrid.py
, thewhile True
loop ends with this:https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/76c46a197f7f7d827f33c36bfe0088568294ecc6/montreal_forced_aligner/textgrid.py#L420-L422
These codes empty the three lists, while they are not empty because of these lines:
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/76c46a197f7f7d827f33c36bfe0088568294ecc6/montreal_forced_aligner/textgrid.py#L377
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/76c46a197f7f7d827f33c36bfe0088568294ecc6/montreal_forced_aligner/textgrid.py#L393
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/76c46a197f7f7d827f33c36bfe0088568294ecc6/montreal_forced_aligner/textgrid.py#L406
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:https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/76c46a197f7f7d827f33c36bfe0088568294ecc6/montreal_forced_aligner/textgrid.py#L383-L387
I added a:
phone_data = []
These codes were tested and worked well now.