marytts.modules.phonemiser
Class AllophoneSet

java.lang.Object
  extended by marytts.modules.phonemiser.AllophoneSet

public class AllophoneSet
extends java.lang.Object


Method Summary
 boolean checkAllophoneSyntax(java.lang.String allophoneString)
          Check whether the given allophone string has a correct syntax according to this allophone set.
static AllophoneSet determineAllophoneSet(org.w3c.dom.Element e)
          For an element in a MaryXML document, do what you can to determine the appropriate AllophoneSet.
static AllophoneSet determineAllophoneSet(java.util.Locale locale)
          Try to determine the Allophone set to use for the given locale.
 Allophone getAllophone(java.lang.String ph)
          Get the allophone with the given name, or null if there is no such allophone.
 java.util.Set<java.lang.String> getAllophoneNames()
          This returns the names of all allophones contained in this AllophoneSet, as a Set of Strings
static AllophoneSet getAllophoneSet(java.lang.String filename)
          Return the allophone set specified by the given filename.
 java.util.Locale getLocale()
           
 java.lang.String getPhoneFeature(java.lang.String ph, java.lang.String featureName)
          For the Allophone with name ph, return the value of the named feature.
 java.util.Set<java.lang.String> getPhoneFeatures()
          Get the list of available phone features for this allophone set.
 java.lang.String[] getPossibleFeatureValues(java.lang.String featureName)
          For the given feature name, get the list of all possible values that the feature can take in this allophone set.
 Allophone getSilence()
          Obtain the silence allophone in this AllophoneSet
 Syllabifier getSyllabifier()
           
 java.lang.String splitAllophoneString(java.lang.String allophoneString)
          Split allophone string into a list of allophone symbols.
 Allophone[] splitIntoAllophones(java.lang.String allophoneString)
          Split a phonetic string into allophone symbols.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAllophoneSet

public static AllophoneSet getAllophoneSet(java.lang.String filename)
                                    throws MaryConfigurationException
Return the allophone set specified by the given filename. It will only be loaded if it was not loaded before.

Parameters:
filename -
Returns:
the allophone set, if one can be created. This method will never return null.
Throws:
MaryConfigurationException - if no allophone set can be loaded from the given file.

determineAllophoneSet

public static AllophoneSet determineAllophoneSet(org.w3c.dom.Element e)
                                          throws MaryConfigurationException
For an element in a MaryXML document, do what you can to determine the appropriate AllophoneSet. First search for the suitable voice, then if that fails, go by locale.

Parameters:
e -
Returns:
an allophone set if there is any way of determining it, or null.
Throws:
MaryConfigurationException - if a suitable allophone set exists in principle, but there were problems loading it.

determineAllophoneSet

public static AllophoneSet determineAllophoneSet(java.util.Locale locale)
                                          throws MaryConfigurationException
Try to determine the Allophone set to use for the given locale.

Parameters:
allophoneSet -
locale -
Returns:
the allophone set defined for the given locale, or null if no such allophone set can be determined.
Throws:
MaryConfigurationException - if an allophone set exists for the given locale in principle, but there were problems loading it.

getLocale

public java.util.Locale getLocale()

getSyllabifier

public Syllabifier getSyllabifier()

getAllophone

public Allophone getAllophone(java.lang.String ph)
Get the allophone with the given name, or null if there is no such allophone.

Parameters:
ph -
Returns:

getSilence

public Allophone getSilence()
Obtain the silence allophone in this AllophoneSet

Returns:

getPhoneFeature

public java.lang.String getPhoneFeature(java.lang.String ph,
                                        java.lang.String featureName)
For the Allophone with name ph, return the value of the named feature.

Parameters:
ph -
featureName -
Returns:
the allophone feature, or null if either the allophone or the feature does not exist.

getPhoneFeatures

public java.util.Set<java.lang.String> getPhoneFeatures()
Get the list of available phone features for this allophone set.

Returns:

getPossibleFeatureValues

public java.lang.String[] getPossibleFeatureValues(java.lang.String featureName)
For the given feature name, get the list of all possible values that the feature can take in this allophone set.

Parameters:
featureName -
Returns:
the list of values, "0" first.
Throws:
java.lang.IllegalArgumentException - if featureName is not a known feature name.

getAllophoneNames

public java.util.Set<java.lang.String> getAllophoneNames()
This returns the names of all allophones contained in this AllophoneSet, as a Set of Strings


splitIntoAllophones

public Allophone[] splitIntoAllophones(java.lang.String allophoneString)
Split a phonetic string into allophone symbols. Symbols representing primary and secondary stress, syllable boundaries, and spaces, will be silently skipped.

Parameters:
allophoneString - the phonetic string to split
Returns:
an array of Allophone objects corresponding to the string given as input
Throws:
java.lang.IllegalArgumentException - if the allophoneString contains unknown symbols.

splitAllophoneString

public java.lang.String splitAllophoneString(java.lang.String allophoneString)
Split allophone string into a list of allophone symbols. Include stress markers (',) and syllable boundaries (-), skip space characters.

Parameters:
allophoneString -
Returns:
a String containing allophones and stress markers / syllable boundaries, separated with spaces
Throws:
java.lang.IllegalArgumentException - if the string contains illegal symbols.

checkAllophoneSyntax

public boolean checkAllophoneSyntax(java.lang.String allophoneString)
Check whether the given allophone string has a correct syntax according to this allophone set.

Parameters:
allophoneString -
Returns:
true if the syntax is correct, false otherwise.