marytts.util.data.text
Class PraatTextGrid

java.lang.Object
  extended by marytts.util.data.text.PraatTextGrid

public class PraatTextGrid
extends java.lang.Object

Representation of a Praat TextGrid annotation. A TextGrid consists of a number of tiers (which can be either TextTiers or, more commonly, IntervalTiers), containing mutually independent label strings and their associated time points.

Author:
steiner

Constructor Summary
PraatTextGrid()
          bare constructor
PraatTextGrid(java.util.Vector<PraatTier> tiers)
          constructor accepting a Vector of PraatTiers
 
Method Summary
 void appendTier(PraatTier tier)
          add a new tier at the end of the TextGrid's tiers
 int getNumberOfTiers()
          getter for number of tiers
 PraatTier getTier(int index)
          getter for individual tier
 double getXmax()
          getter for TextGrid end time.
 double getXmin()
          getter for TextGrid start time.
 void setTiers(java.util.Vector<PraatTier> tiers)
          replace tiers by specified Vector of tiers
 java.lang.String toString()
          string representation of TextGrid, as it is written into text files by Praat and this.writeToFile().
 void writeToFile(java.lang.String fileName)
          write TextGrid to text file which can be used by Praat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PraatTextGrid

public PraatTextGrid()
bare constructor


PraatTextGrid

public PraatTextGrid(java.util.Vector<PraatTier> tiers)
constructor accepting a Vector of PraatTiers

Parameters:
tiers -
Method Detail

getXmin

public double getXmin()
getter for TextGrid start time. queries all tiers and sets start time to earliest time found

Returns:
start time of TextGrid

getXmax

public double getXmax()
getter for TextGrid end time. queries all tiers and sets end time to latest time found

Returns:
end time of TextGrid

getNumberOfTiers

public int getNumberOfTiers()
getter for number of tiers

Returns:
number of tiers

getTier

public PraatTier getTier(int index)
getter for individual tier

Parameters:
index - of desired tier
Returns:
desired tier

setTiers

public void setTiers(java.util.Vector<PraatTier> tiers)
replace tiers by specified Vector of tiers

Parameters:
tiers -

appendTier

public void appendTier(PraatTier tier)
add a new tier at the end of the TextGrid's tiers

Parameters:
tier - to be appended

writeToFile

public void writeToFile(java.lang.String fileName)
                 throws java.io.IOException
write TextGrid to text file which can be used by Praat

Parameters:
fileName - of TextGrid file
Throws:
java.io.IOException

toString

public java.lang.String toString()
string representation of TextGrid, as it is written into text files by Praat and this.writeToFile(). Note that leading whitespace is not generated

Overrides:
toString in class java.lang.Object