pub struct TextGrid { /* private fields */ }Expand description
Represents a TextGrid, which is a data structure used in the linguistic research program Praat
to annotate speech data. It can support either
Implementations§
Source§impl TextGrid
impl TextGrid
Sourcepub fn set_xmin<W: Into<Option<bool>>>(&mut self, xmin: f64, warn: W)
pub fn set_xmin<W: Into<Option<bool>>>(&mut self, xmin: f64, warn: W)
Sets the xmin time value of the whole TextGrid in seconds.
§Arguments
xmin- The new xmin value.warn- If Some(true), displays a warning if any tier has an xmin lesser thanxmin.
Sourcepub fn set_xmax<W: Into<Option<bool>>>(&mut self, xmax: f64, warn: W)
pub fn set_xmax<W: Into<Option<bool>>>(&mut self, xmax: f64, warn: W)
Sets the xmax time value of the whole TextGrid in seconds.
§Arguments
xmax- The new xmax value.warn- If Some(true), displays a warning if any tier has an xmax greater thanxmax.
Sourcepub fn push_tier<W: Into<Option<bool>> + Copy>(&mut self, tier: Tier, warn: W)
pub fn push_tier<W: Into<Option<bool>> + Copy>(&mut self, tier: Tier, warn: W)
Pushes a new, user-made tier to the TextGrid.
§Arguments
tier- The tier to be added.warn- If Some(true), displays a warning if the tier has a minimum or maximum point that is outside the range of theTextGrid.
Sourcepub fn delete_tier<W: Into<Option<bool>> + Copy>(&mut self, name: &str, warn: W)
pub fn delete_tier<W: Into<Option<bool>> + Copy>(&mut self, name: &str, warn: W)
Deletes a tier using it’s name.
§Arguments
name- The name of the tier to delete.warn- If true, displays a warning if the tier does not exist.
Sourcepub fn write(&self, path: PathBuf, format: OutputFormat) -> Result<()>
pub fn write(&self, path: PathBuf, format: OutputFormat) -> Result<()>
Writes the TextGrid to a file or folder in the specified format.
If given a folder path, the TextGrid will be written to a file in the folder with the same name as the TextGrid’s name field.
Long TextGrids are the typical format, while short
TextGrids are readable by Praat and do not include
extraneous data.
§Arguments
path- The path to the file.format- The output format.
§Errors
Returns an error if there was a problem creating or writing to the file.
Sourcepub fn check_overlaps(&self) -> Option<Vec<(String, (u64, u64))>>
pub fn check_overlaps(&self) -> Option<Vec<(String, (u64, u64))>>
Checks the TextGrid for overlapping intervals or duplicate points.
§Returns
Returns Some([tier_name, (index1, index2)]) if an overlapping interval or point is found, otherwise None.
Sourcepub fn fix_boundaries<P: Into<Option<bool>> + Copy>(&mut self, prefer_first: P)
pub fn fix_boundaries<P: Into<Option<bool>> + Copy>(&mut self, prefer_first: P)
Calls fix_overlaps on all IntervalTiers in the TextGrid.
§Arguments
prefer_first- If true, the first interval’sxmaxwill be raised or lowered to the new interval’sxminin the case of a gap or overlap. If false, the second interval’sxminwill be raised or lowered to the first interval’s.