public abstract class Model extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
applyTo |
protected InputStream |
dataStream
The stream from which we will read our acoustic model.
|
protected TargetFeatureComputer |
featureComputer
The producer of feature vectors for the features in
predictionFeatureNames as computed by the feature processors
in featureManager . |
protected FeatureProcessorManager |
featureManager
The feature processors used for prediction.
|
protected String |
featureName
The name of the predicted acoustic feature, if any.
|
protected String |
predictFrom |
protected String |
predictionFeatureNames
The names of the features used for prediction.
|
protected String |
targetAttributeFormat |
protected String |
targetAttributeName
The attribute into which the predicted acoustic feature should be written.
|
protected String |
voiceName
The voice with which this model is associated
|
Modifier | Constructor and Description |
---|---|
protected |
Model(FeatureProcessorManager featureManager,
String voiceName,
InputStream dataStream,
String targetAttributeName,
String targetAttributeFormat,
String featureName,
String predictFrom,
String applyTo)
Model constructor
|
Modifier and Type | Method and Description |
---|---|
void |
applyFromTo(List<Element> predictFromElements,
List<Element> applyToElements)
Apply this Model to a List of Elements, predicting from a different List of Elements
|
void |
applyTo(List<Element> elements)
Apply this Model to a List of Elements, predicting from those same Elements
|
protected abstract float |
evaluate(Target target)
Evaluate model on a Target to obtain the target value as a float.
|
String |
getApplyTo() |
String |
getFeatureName() |
String |
getPredictFrom() |
String |
getTargetAttributeName() |
protected List<Target> |
getTargets(List<Element> elements)
For a list of
PHONE elements, return a list of Targets, where each Target is constructed from the
corresponding Element. |
String |
getVoiceName() |
protected void |
load()
Try to load this model and set the target feature computer appropriately.
|
protected abstract void |
loadData()
Load dataFile for this model; only extension classes know how to do this
|
protected void |
setupFeatureComputer() |
protected InputStream dataStream
protected String voiceName
protected String targetAttributeName
protected String targetAttributeFormat
protected String featureName
targetAttributeName
.protected FeatureProcessorManager featureManager
protected String predictionFeatureNames
protected TargetFeatureComputer featureComputer
predictionFeatureNames
as computed by the feature processors
in featureManager
.protected String predictFrom
protected String applyTo
protected Model(FeatureProcessorManager featureManager, String voiceName, InputStream dataStream, String targetAttributeName, String targetAttributeFormat, String featureName, String predictFrom, String applyTo)
featureManager
- the feature processor manager used to compute the symbolic features used for predictionvoiceName
- name of the voicedataStream
- data file for this ModeltargetAttributeName
- attribute in MaryXML to predicttargetAttributeFormat
- printf-style format String to specify the attribute value, i.e. "%.3f" to round to 3 decimal places; "%s" by
defaultfeatureName
- name of the custom continuous feature predicted by this model, or nullpredictFrom
- key of Element Lists from which to predict values; "segments" by defaultapplyTo
- key of Element Lists to which to apply values; "segments" by defaultprotected final void load() throws MaryConfigurationException
MaryConfigurationException
- if the model cannot be set up properly.protected abstract void loadData() throws IOException, MaryConfigurationException
IOException
- if any files cannot be properly readMaryConfigurationException
- if files can be read but contain problematic contentprotected final void setupFeatureComputer() throws MaryConfigurationException
MaryConfigurationException
public void applyTo(List<Element> elements) throws MaryConfigurationException
elements
- Elements for which to predict the valuesMaryConfigurationException
- if attribute values cannot be predicted because of an invalid voice configurationpublic void applyFromTo(List<Element> predictFromElements, List<Element> applyToElements) throws MaryConfigurationException
predictFromElements
- Elements from which to predict the valuesapplyToElements
- Elements to which to apply the values predicted by this ModelMaryConfigurationException
- if attribute values cannot be predicted because of an invalid voice configurationprotected List<Target> getTargets(List<Element> elements)
PHONE
elements, return a list of Targets, where each Target is constructed from the
corresponding Element.elements
- List of Elementsprotected abstract float evaluate(Target target) throws Exception
target
- targetException
- if the target value cannot be predictedpublic String getVoiceName()
public String getFeatureName()
public String getTargetAttributeName()
public String getPredictFrom()
public String getApplyTo()
Copyright © 2000–2016 DFKI GmbH. All rights reserved.