Package com.sun.speech.freetts.clunits

# Class ClusterUnitSelector

java.lang.Object
com.sun.speech.freetts.clunits.ClusterUnitSelector

All Implemented Interfaces:
  `UtteranceProcessor`

public class ClusterUnitSelector extends Object implements UtteranceProcessor
Generates the Unit Relation of an Utterance from the Segment Relation.

## Constructor Summary

Constructors
Constructor
Description
`ClusterUnitSelector(URL url)`
Constructs a ClusterUnitSelector.
`ClusterUnitSelector(URL url, de.dfki.lt.freetts.ClusterUnitNamer unitNamer)`
Constructs a ClusterUnitSelector.

## Method Summary

Modifier and Type
Method
Description
`SampleInfo`
`getSampleInfo()`
Get the sample info for the underlying database.
`void`
`processUtterance(Utterance utterance)`
Generates the Unit Relation from the Segment Relation.
`protected void`
`setUnitName(Item seg)`
Sets the cluster unit name given the segment.
`String`
`toString()`
Retrieves the string representation of this object.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ClusterUnitSelector

public ClusterUnitSelector(URL url) throws IOException
Constructs a ClusterUnitSelector.

Parameters:
  `url` - the URL for the unit database. If the URL path ends with a '.bin' it is assumed that the DB is a binary database, otherwise, its assumed that its a text database1
Throws:
  `IOException` - if an error occurs while loading the database

### ClusterUnitSelector

public ClusterUnitSelector(URL url, de.dfki.lt.freetts.ClusterUnitNamer unitNamer) throws IOException
Constructs a ClusterUnitSelector.

Parameters:
  `url` - the URL for the unit database. If the URL path ends with a '.bin' it is assumed that the DB is a binary database, otherwise, its assumed that its a text database1
  `unitNamer` - an optional unit namer, specifying how the cluster units are called in the voice database referenced by url. If this is null, an ldom unit naming scheme will be used (e.g., 'ae_afternoon' for the phoneme 'ae' in the word 'afternoon'.
Throws:
  `IOException` - if an error occurs while loading the database

## Method Details

### getSampleInfo

public SampleInfo getSampleInfo()
Get the sample info for the underlying database.

Returns:
  the sample info object

### processUtterance

public void processUtterance(Utterance utterance) throws ProcessException
Generates the Unit Relation from the Segment Relation.
Implementation note:
Populates the segment relation with segment names of the form: XX_YY where XX is the segment name (typically a phoneme) and YY is the word that the segment is in (stripped and lower case). The first step in cluster unit selection is to determine the unit type for each unit in the utterance. The unit type for selection in the simple talking clock example (cmu_time_awb) is done per phone. The unit type consists of the phone name followed by the word the phone comes from (e.g., n_now for the phone 'n' in the word 'now'). Invoke the Viterbi algorithm (via a viterbi class) that selects the proper units for the segment and adds that to each segment item. For each segment, create a unit and attach features based upon the selected units.

Specified by:
  `processUtterance` in interface `UtteranceProcessor`
Parameters:
  `utterance` - the utterance to generate the Unit Relation
Throws:
  `ProcessException` - if an IOException is thrown during the processing of the utterance

### setUnitName

protected void setUnitName(Item seg)
Sets the cluster unit name given the segment.

Parameters:
  `seg` - the segment item that gets the name

### toString

public String toString()
Retrieves the string representation of this object.

Overrides:
  `toString` in class `Object`
Returns:
  the string representation of this object