public class ClusterUnitDatabase extends Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
ClusterUnitDatabase.DatabaseClusterUnit
Represents a unit for the cluster database.
|
(package private) class |
ClusterUnitDatabase.UnitOriginInfo
Represents debug information about the origin of a unit.
|
Modifier and Type | Field and Description |
---|---|
private Map |
cartMap |
(package private) static int |
CLUNIT_NONE |
private int |
continuityWeight |
private CART |
defaultCart |
private int |
extendSelections |
private int |
joinMethod |
private int[] |
joinWeights |
private int |
joinWeightShift |
private int |
lineCount |
private static int |
MAGIC |
private SampleSet |
mcep |
private int |
optimalCoupling |
private SampleSet |
sts |
private List |
unitList |
private ClusterUnitDatabase.UnitOriginInfo[] |
unitOrigins |
private ClusterUnitDatabase.DatabaseClusterUnit[] |
units |
private UnitType[] |
unitTypes |
private List |
unitTypesList |
private static int |
VERSION |
Constructor and Description |
---|
ClusterUnitDatabase(URL url,
boolean isBinary)
Creates the UnitDatabase from the given input stream.
|
Modifier and Type | Method and Description |
---|---|
private int |
calcJoinWeightShift(int[] joinWeights)
Calculates the join weight shift.
|
boolean |
compare(ClusterUnitDatabase other)
Determines if two databases are identical.
|
(package private) void |
dumpBinary(String path)
Dumps a binary form of the database.
|
private void |
error(String s)
Displays an error message
|
(package private) int |
getContinuityWeight()
Retrieves the continuity weight setting.
|
(package private) int |
getEnd(int unitEntry)
Retrieves the ending sample index for the
given entry.
|
(package private) int |
getExtendSelections()
Retrieves the extend selections setting.
|
(package private) int[] |
getJoinWeights()
Retrieves the join weights.
|
(package private) int |
getJoinWeightShift()
Determines if the application of the given join weights could
be applied as a simple right-shift.
|
(package private) SampleSet |
getMcep()
Gets the Mel Ceptra list.
|
(package private) String |
getName()
Returns the name of this UnitDatabase.
|
(package private) int |
getNextUnit(int which)
Gets the next unit.
|
(package private) int |
getOptimalCoupling()
Retrieves the optimal coupling setting.
|
(package private) int |
getPhone(int unitEntry)
Retrieves the phone for the given entry
|
(package private) int |
getPrevUnit(int which)
Gets the previous units.
|
(package private) SampleInfo |
getSampleInfo()
Returns the sample info for this set of data.
|
(package private) int |
getStart(int unitEntry)
Retrieves the begininning sample index for the
given entry.
|
(package private) SampleSet |
getSts()
Gets the sample list.
|
(package private) CART |
getTree(String unitType)
Returns the cart of the given unit type.
|
(package private) ClusterUnitDatabase.DatabaseClusterUnit |
getUnit(int which)
Looks up the unit with the given index.
|
(package private) ClusterUnitDatabase.DatabaseClusterUnit |
getUnit(String unitName)
Looks up the unit with the given name.
|
(package private) int |
getUnitIndex(String unitType,
int instance)
Retrieves the unit index given a unit type and val.
|
(package private) int |
getUnitIndexName(String name)
Retrieves the index for the name given a name.
|
(package private) ClusterUnitDatabase.UnitOriginInfo |
getUnitOriginInfo(int which)
Looks up the origin info for the unit with the given index.
|
(package private) int |
getUnitTypeIndex(String name)
Retrieves the type index for the name given a name.
|
(package private) boolean |
isUnitTypeEqual(int unitA,
int unitB)
Determines if the unit types are equal.
|
private void |
loadBinary(ByteBuffer bb)
Loads the database from the given byte buffer.
|
private void |
loadBinary(DataInputStream is)
Loads the database from the given input stream.
|
private void |
loadBinary(InputStream is)
Loads a binary file from the input stream.
|
private void |
loadText(InputStream is)
Loads the database from the given input stream.
|
private void |
loadUnitOrigins(InputStream is)
Load debug info about the origin of units from the given input stream.
|
static void |
main(String[] args)
Manipulates a ClusterUnitDatabase.
|
private void |
parseAndAdd(String line,
BufferedReader reader)
Parses and process the given line.
|
static final int CLUNIT_NONE
private ClusterUnitDatabase.DatabaseClusterUnit[] units
private ClusterUnitDatabase.UnitOriginInfo[] unitOrigins
private int continuityWeight
private int optimalCoupling
private int extendSelections
private int joinMethod
private int[] joinWeights
private int joinWeightShift
private CART defaultCart
private transient int lineCount
private transient List unitTypesList
private static final int MAGIC
private static final int VERSION
ClusterUnitDatabase(URL url, boolean isBinary) throws IOException
is
- the input stream to read the database fromisBinary
- the input stream is a binary streamIOException
- if there is trouble opening the DBint getStart(int unitEntry)
unitEntry
- the entry of interestint getEnd(int unitEntry)
unitEntry
- the entry of interestint getPhone(int unitEntry)
unitEntry
- the entry of interestCART getTree(String unitType)
unitType
- the type of cartint getUnitTypeIndex(String name)
name
- the nameint getUnitIndex(String unitType, int instance)
unitType
- the type of the unitinstance
- the value associated with the unitint getUnitIndexName(String name)
name
- the nameint getExtendSelections()
int getNextUnit(int which)
int getPrevUnit(int which)
which
- which unit is of interestboolean isUnitTypeEqual(int unitA, int unitB)
unitA
- the index of unit aunitB
- the index of unit Btrue
if the types of units a and b are
equal; otherwise return false
int getOptimalCoupling()
int getContinuityWeight()
int[] getJoinWeights()
ClusterUnitDatabase.DatabaseClusterUnit getUnit(String unitName)
unitName
- the name of the unit to look forClusterUnitDatabase.DatabaseClusterUnit getUnit(int which)
index
- the index of the unit to look forClusterUnitDatabase.UnitOriginInfo getUnitOriginInfo(int which)
index
- the index of the unit to look forSampleInfo getSampleInfo()
int getJoinWeightShift()
private int calcJoinWeightShift(int[] joinWeights)
joinWeights
- the weights to checkprivate void loadText(InputStream is)
is
- the input streamprivate void parseAndAdd(String line, BufferedReader reader) throws IOException
line
- the line to processreader
- the source for the linesIOException
- if an error occurs while readingprivate void loadBinary(InputStream is) throws IOException
is
- the input stream to read the database fromIOException
- if there is trouble opening the DBprivate void loadBinary(ByteBuffer bb) throws IOException
bb
- the byte buffer to load the db fromIOException
- if there is trouble opening the DBprivate void loadBinary(DataInputStream is) throws IOException
is
- the input stream to load the db fromIOException
- if there is trouble opening the DBprivate void loadUnitOrigins(InputStream is) throws IOException
is
- the input stream from which to read the debug info.IOException
- if a read problem occurs.void dumpBinary(String path)
path
- the path to dump the file topublic boolean compare(ClusterUnitDatabase other)
other
- the database to compare this one topublic static void main(String[] args)
Usage
java com.sun.speech.freetts.clunits.ClusterUnitDatabase
[options]
Options
-src path
provides a directory
path to the source text for the database
-dest path
provides a directory
for where to place the resulting binaries
-generate_binary [filename]
reads
in the text version of the database and generates
the binary version of the database.
-compare
Loads the text and
binary versions of the database and compares them to
see if they are equivalent.
-showTimes
shows timings for any
loading, comparing or dumping operation
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses