crowsetta.data.data.get

Contents

crowsetta.data.data.get#

crowsetta.data.data.get(format: str, user_data_dir: str | bytes | PathLike | Path | None = None) ExampleAnnotFile[source]#

Get an example annotation files.

Parameters:
  • format (str) – Name of annotation format. Should be the shorthand string name, as listed by crowsetta.formats.as_list.

  • user_data_dir (str, pathlib.Path) – Location where example annotation files are stored. If none is given, defaults to the value of crowsetta.data.data.APP_DIRS.user_data_dir This default can be changed, but will require passing the same path in every time this function is called to avoid being prompted about extracting the example files to the default location.

Returns:

example_annot_file – class instance with attributes annot_path and citation. If the annotation files have been extracted to the local file system, then annot_path will be a path to a file. Otherwise, annot_path will be a context manager that should be used as part of a with statement to open the file; see Examples below or examples in the docstrings.

Return type:

ExampleAnnotFile

Examples

>>> # example of a context manager
>>> example = crowsetta.data.get('textgrid')
>>> with example.annot_path as annot_path:
...     textgrid = crowsetta.formats.seq.TextGrid.from_file(annot_path)