FieldDB / PraatTextGridJS

A small library which can parse TextGrid into json and json into TextGrid
Apache License 2.0
11 stars 5 forks source link

Only works for one format #3

Open MysteryPancake opened 6 years ago

MysteryPancake commented 6 years ago

The Praat website provides several examples of TextGrid file formats. These examples include a shortened format:

File type = "ooTextFile"
Object class = "TextGrid"

0
2.3
<exists>
3
"IntervalTier"
"Mary"
0
2.3
1
0
2.3
""
"IntervalTier"
"John"
0
2.3
1
0
2.3
""
"TextTier"
"bell"
0
2.3
0

As well as a format using lots of comments:

"ooTextFile"
"TextGrid"
0 2.3 ! time domain of TextGrid
<exists>
3 tiers
"IntervalTier" "Mary" ! type and name of tier 1
0 2.3 ! time domain of tier 1
1 interval coming
0 2.3 "" ! interval 1 on tier 1
"IntervalTier" "John" ! type and name of tier 2
0 2.3 ! time domain of tier 2
1 interval coming
0 2.3 "" ! interval 1 on tier 2
"TextTier" "bell" ! type and name of tier 3
0 2.3 ! time domain of tier 3
0 points coming

Both of these formats are valid and can be parsed by Praat. However, this converter cannot parse either of these formats to JavaScript.

MysteryPancake commented 6 years ago

Here is an example of a script which parses the formats above for reference.