Closed CarlosJimenez closed 4 years ago
Hi Carlos, To make sure I understand, you are asking for two unrelated changes? 1) read in textgrids while preserving unlabeled intervals 2) associate an index with each entry
1 is a simple change that I have already implemented in my python praatio library.
I am less certain about 2. It seems simple enough to add but maintaining the index could be difficult. The information would be discarded when saving the textgrid right? Would it be difficult to find/maintain the index information yourself during runtime?
I should be able to implement 1 today or tomorrow. Thank you!
Hi Tim Wow! You are so fast to answer. Thank you very much
To make sure I understand, you are asking for two unrelated changes?
I suggested 2 possible ways to solve the issue.
including the interval number as a associated index solves my issue
I am less certain about 2. It seems simple enough to add but maintaining the index could be difficult. The information would be discarded when saving the textgrid right? Would it be difficult to find/maintain the index information yourself during runtime?
The index is already in TextGrid at interval[x] (I am using the latest version of Praat, maybe in previous releases the TextGrid format was different)
xmax = 3328.2349791666666
intervals: size = 83
intervals [1]:
xmin = 0
xmax = 68.84705897920229
text = ""
intervals [2]:
xmin = 68.84705897920229
xmax = 70.995053810749
text = "Burla2"
....
I should be able to implement 1 today or tomorrow. Thank you!
Don't worry about suggestion 2. If you implement 1 I will be happy!!! You are awesome, Tim !!!!
Best regards
Hi Carlos,
I've released a new version 2.3.0
.
The function parseTextgrid
now has the signature parseTextgrid(text, readRaw = false)
If readRaw
is set to True, intervals and points with empty labels ''
will not be removed from the input. Will that work for your case?
The latest version is on npm, so if you update, you should be able to get it. Please let me know if you have any questions or concerns!
Thanks! Tim
I left label = label.trim();
where it was originally. I don't think it affected your use case. But if you want, I can move it too.
Hi Tim It works perfectly. Thank you very much for your help and time. Again, you are awesome!!!! Best regards
Hi, I started to use praatIO in a project. It's really nice to handle TextGrids from javascript. In the TextGrid that I am using, I use empty labels, and they are not listed in parseTextgrid (short or Normal) We have emptyLabels to mark intervals in the TextGrid pending of posterior labelling I use interval number from Praat scripts to cut parts of the Sound. So interval number is important in my case.
In lines 137, 154, 237, 249, of textgrid_io.js you use
I don't know what lateral impacts could have to remove those lines.
Maybe a nice improvement could be adding interval number to entryList as a new element in the entry
Here you have my problematic TextGrid example.TextGrid.zip
If you are so kind to have a look in this issue, I could give you more info if you need it. Thank you very much for your work.
Best regards.