pyeeg.features.TextGridParser.parse_from_string

TextGridParser.parse_from_string(content: str) TextGrid

Parse a TextGrid from a string.

Iterates over the lines of a Praat TextGrid in short text format. Two tier header formats are supported:

  • compact: item [N]: "tier_name" on a single line.

  • long (Praat’s default): an item [N]: header line followed by class = "..." and name = "tier_name" lines.

Two interval formats are supported:

  • compact: intervals [N]: "label" start end on a single line.

  • long (Praat’s default): an intervals [N]: header line followed by xmin = ..., xmax = ... and text = "..." lines.

Tier and interval indices reported by Praat are ignored; only names, labels, and timestamps are kept.

Parameters:

content (str) – Full text content of a Praat TextGrid file.

Returns:

textgrid – Parsed TextGrid. intervals maps tier names to the parsed intervals in order of appearance.

Return type:

TextGrid