rustling.textgrid#
TextGrid (Praat) file parsing.
Package Contents#
- class rustling.textgrid.Interval#
A single interval within an IntervalTier.
- class rustling.textgrid.Point#
A single point within a TextTier (PointTier).
- class rustling.textgrid.IntervalTier#
An interval tier within a TextGrid file.
- class rustling.textgrid.TextTier#
A text tier (PointTier) within a TextGrid file.
- class rustling.textgrid.TextGrid#
TextGrid (Praat) data reader.
- classmethod from_strs(strs: Sequence[str], ids: Sequence[str] | None = None, parallel: bool = True) TextGrid#
Parse TextGrid data from in-memory strings.
- classmethod from_files(paths: Sequence[str | os.PathLike[str]], *, parallel: bool = True) TextGrid#
Load TextGrid data from file paths.
- classmethod from_dir(path: str | os.PathLike[str], *, match: str | None = None, extension: str = '.TextGrid', parallel: bool = True) TextGrid#
Recursively load TextGrid data from a directory.
- classmethod from_zip(path: str | os.PathLike[str], *, match: str | None = None, extension: str = '.TextGrid', parallel: bool = True) TextGrid#
Load TextGrid data from a ZIP archive.
- classmethod from_git(url: str, *, rev: str | None = None, depth: int | None = None, match: str | None = None, extension: str = '.TextGrid', cache_dir: str | os.PathLike[str] | None = None, force_download: bool = False, parallel: bool = True) TextGrid#
Load TextGrid data from a git repository.
- classmethod from_url(url: str, *, match: str | None = None, extension: str = '.TextGrid', cache_dir: str | os.PathLike[str] | None = None, force_download: bool = False, parallel: bool = True) TextGrid#
Load TextGrid data from a URL.
- tiers() list[list[IntervalTier | TextTier]]#
Return tiers as a list of lists, one list per file.
- to_chat_strs(*, participants: Sequence[str] | None = None) list[str]#
Return CHAT format strings, one per file.
- to_chat(*, participants: Sequence[str] | None = None) rustling.chat.CHAT#
Convert to a CHAT object.
- to_chat_files(dir_path: str | os.PathLike[str], /, *, participants: Sequence[str] | None = None, filenames: Sequence[str] | None = None) None#
Write CHAT (.cha) files to a directory.
- to_elan() rustling.elan.ELAN#
Convert to an ELAN object.
- to_elan_files(dir_path: str | os.PathLike[str], /, *, filenames: Sequence[str] | None = None) None#
Write ELAN (.eaf) files to a directory.
- to_srt_strs(*, participants: Sequence[str] | None = None) list[str]#
Return SRT format strings, one per file.
- to_srt(*, participants: Sequence[str] | None = None) rustling.srt.SRT#
Convert to an SRT object.
- to_srt_files(dir_path: str | os.PathLike[str], /, *, participants: Sequence[str] | None = None, filenames: Sequence[str] | None = None) None#
Write SRT (.srt) files to a directory.
- to_files(dir_path: str | os.PathLike[str], /, *, filenames: Sequence[str] | None = None) None#
Write TextGrid files to a directory.
- rustling.textgrid.read_textgrid(path: str | os.PathLike[str], *, cls: type[TextGrid] = TextGrid) TextGrid#
Read TextGrid data.
- Parameters:
path – Path to a
.zipfile, a local directory containing.TextGridfiles, a single.TextGridfile, a git repository URL (ending in.git), or an HTTP/HTTPS URL.cls – The class used to create the reader. Must be
TextGridor a subclass of it.
- Returns:
A
TextGridinstance.- Raises:
TypeError – If cls is not
TextGridor a subclass of it.ValueError – If path does not point to a recognized source.