public class JoinCostFeatures extends Object implements JoinCostFunction
| Modifier and Type | Class and Description |
|---|---|
static class |
JoinCostFeatures.JoinCostReporter |
| Modifier and Type | Field and Description |
|---|---|
protected double[] |
cumulWeightedSignalCosts |
protected boolean |
debugShowCostGraph |
protected JoinCostFeatures.JoinCostReporter |
jcr |
protected int |
nCostComputations |
protected PrecompiledJoinCostReader |
precompiledCosts |
protected float |
wPhonetic |
protected float |
wSignal |
| Constructor and Description |
|---|
JoinCostFeatures()
Empty constructor; when using this, call load() separately to initialise this class.
|
JoinCostFeatures(String fileName)
Constructor which read a Mary Join Cost file.
|
| Modifier and Type | Method and Description |
|---|---|
double |
cost(int u1,
int u2)
Deliver the join cost between two units described by their index.
|
protected double |
cost(Target t1,
Target t2)
Deprecated.
|
double |
cost(Target t1,
Unit u1,
Target t2,
Unit u2)
A combined cost computation, as a weighted sum of the signal-based cost (computed from the units) and the phonetics-based
cost (computed from the targets).
|
float[] |
getLeftJCF(int u)
Gets the array of left join cost features for a particular unit index.
|
int |
getNumberOfFeatures()
Get the number of feature weights and weighting functions.
|
int |
getNumberOfUnits()
Get the number of units.
|
float[] |
getRightJCF(int u)
Gets the array of right join cost features for a particular unit index.
|
void |
init(String configPrefix)
Initialise this join cost function by reading the appropriate settings from the MaryProperties using the given
configPrefix.
|
void |
load(String joinFileName,
InputStream weightStream,
String precompiledCostFileName,
float wSignal)
Load weights and values from the given file
|
static Object[] |
readJoinCostWeightsFile(String fileName)
Read the join cost weight specifications from the given file.
|
static Object[] |
readJoinCostWeightsStream(InputStream weightStream)
Read the join cost weight specifications from the given file.
|
protected float wSignal
protected float wPhonetic
protected boolean debugShowCostGraph
protected double[] cumulWeightedSignalCosts
protected int nCostComputations
protected PrecompiledJoinCostReader precompiledCosts
protected JoinCostFeatures.JoinCostReporter jcr
public JoinCostFeatures()
public JoinCostFeatures(String fileName) throws IOException, MaryConfigurationException
fileName - fileNameIOException - IOExceptionMaryConfigurationException - MaryConfigurationExceptionpublic void init(String configPrefix) throws MaryConfigurationException
init in interface JoinCostFunctionconfigPrefix - the prefix for the (voice-specific) config entries to use when looking up files to load.MaryConfigurationException - MaryConfigurationExceptionpublic void load(String joinFileName, InputStream weightStream, String precompiledCostFileName, float wSignal) throws IOException, MaryConfigurationException
load in interface JoinCostFunctionjoinFileName - the file from which to read default weights and join cost featuresweightStream - an optional file from which to read weights, taking precedence overprecompiledCostFileName - an optional file containing precompiled join costswSignal - Relative weight of the signal-based join costs relative to the phonetic join costs computed from the targetIOException - IOExceptionMaryConfigurationException - MaryConfigurationExceptionpublic static Object[] readJoinCostWeightsFile(String fileName) throws IOException, FileNotFoundException
fileName - the text file containing the join weightsIOException - IOExceptionFileNotFoundException - FileNotFoundExceptionpublic static Object[] readJoinCostWeightsStream(InputStream weightStream) throws IOException, FileNotFoundException
weightStream - the text file containing the join weightsIOException - IOExceptionFileNotFoundException - FileNotFoundExceptionpublic int getNumberOfFeatures()
public int getNumberOfUnits()
public float[] getLeftJCF(int u)
u - The index of the considered unit.public float[] getRightJCF(int u)
u - The index of the considered unit.public double cost(int u1,
int u2)
u1 - the left unitu2 - the right unitpublic double cost(Target t1, Unit u1, Target t2, Unit u2)
cost in interface JoinCostFunctiont1 - The left target.u1 - The left unit.t2 - The right target.u2 - The right unit.Copyright © 2000–2016 DFKI GmbH. All rights reserved.