Class TextGridFileParser


  • public class TextGridFileParser
    extends java.lang.Object
    Parser and exporter for Praat TextGrid annotation files. I could not find a TextGrid syntax documentation. The syntax is derived only from example TextGrid files.
    Author:
    K.Jaensch, klausj@phonetik.uni-muenchen.de
    • Constructor Summary

      Constructors 
      Constructor Description
      TextGridFileParser​(float sampleRate)
      Create parser.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getXmax​(Level tier)  
      double getXmin​(Level tier)  
      static void main​(java.lang.String[] args)
      main method for test purposes.
      Bundle parse​(java.io.File textGridFile, java.nio.charset.Charset charset)
      Parse TextGrid file.
      Bundle parse​(java.io.Reader reader)
      Parse TxtGrid content from reader.
      void write​(Bundle bundle, java.io.Writer writer)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TextGridFileParser

        public TextGridFileParser​(float sampleRate)
        Create parser. The sample rate is required, because the Java annotation model in this package is based on frame counts rather than time values.
        Parameters:
        sampleRate - sample rate of the audio file
    • Method Detail

      • parse

        public Bundle parse​(java.io.File textGridFile,
                            java.nio.charset.Charset charset)
                     throws java.io.IOException
        Parse TextGrid file.
        Parameters:
        textGridFile - TextGrid file
        charset - encoding charset of the file
        Returns:
        annotation object
        Throws:
        java.io.IOException
      • parse

        public Bundle parse​(java.io.Reader reader)
                     throws java.io.IOException
        Parse TxtGrid content from reader.
        Parameters:
        reader - TextGrid input
        Returns:
        annotation object
        Throws:
        java.io.IOException
      • getXmin

        public double getXmin​(Level tier)
      • getXmax

        public double getXmax​(Level tier)
      • write

        public void write​(Bundle bundle,
                          java.io.Writer writer)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • main

        public static void main​(java.lang.String[] args)
        main method for test purposes.