static class ClusterUnitSelector.Viterbi extends Object
For each candidate for the current unit, calculate the cost between it and the first candidate in the next unit. Save only the path that has the least cost. By default, if two candidates come from units that are adjacent in the database, the cost is 0 (i.e., they were spoken together, so they are a perfect match).
Repeat the previous process for each candidate in the next unit, creating a list of least cost paths between the candidates between the current unit and the unit following it.
Toss out all candidates in the current unit that are not included in a path.
Move to the next unit and repeat the process.
Modifier and Type | Field and Description |
---|---|
private boolean |
bigIsGood |
private ClusterUnitDatabase |
clunitDB |
private FeatureSet |
f |
private ClusterUnitSelector.ViterbiPoint |
lastPoint |
private int |
numStates |
private ClusterUnitSelector.ViterbiPoint |
timeline |
Constructor and Description |
---|
Viterbi(Relation segs,
ClusterUnitDatabase db)
Creates a Viterbi class to process the given utterance.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addPath(ClusterUnitSelector.ViterbiPoint point,
ClusterUnitSelector.ViterbiPath newPath)
Add the new path to the state path if it is
better than the current path.
|
(package private) void |
addPaths(ClusterUnitSelector.ViterbiPoint point,
ClusterUnitSelector.ViterbiPath path)
Try to add paths to the given point.
|
(package private) void |
copyFeature(String feature)
Given a feature, copy the value associated with feature
name from the path to each item in the path.
|
(package private) void |
decode()
Carry out a Viterbi search in for a prepared queue of ViterbiPoints.
|
private ClusterUnitSelector.ViterbiPath |
findBestPath()
Find the best path.
|
private ClusterUnitSelector.ViterbiCandidate |
getCandidate(Item item)
Finds the best (queue of) candidate(s) for a given (segment) item.
|
Object |
getFeature(String name)
Gets the value for the given feature.
|
int |
getFrameDistance(int a,
int b,
int[] joinWeights,
int order)
Get the 'distance' between the frames a and b.
|
(package private) Cost |
getOptimalCouple(int u0,
int u1)
Find the optimal coupling frame for a pair of units.
|
(package private) int |
getOptimalCoupleFrame(int u0,
int u1)
Returns the distance between the successive potential
frames.
|
private ClusterUnitSelector.ViterbiPath |
getPath(ClusterUnitSelector.ViterbiPath path,
ClusterUnitSelector.ViterbiCandidate candidate)
Construct a new path element linking a previous path to the given candidate.
|
private boolean |
isBetterThan(int a,
int b)
See if a is better than b.
|
(package private) boolean |
result(String feature)
Find the best path through the decoder, adding the feature
name to the candidate.
|
void |
setFeature(String name,
Object obj)
Sets the given feature to the given value.
|
private int numStates
private boolean bigIsGood
private ClusterUnitSelector.ViterbiPoint timeline
private ClusterUnitSelector.ViterbiPoint lastPoint
private FeatureSet f
private ClusterUnitDatabase clunitDB
public Viterbi(Relation segs, ClusterUnitDatabase db)
public void setFeature(String name, Object obj)
name
- the name of the featureobj
- the new value.public Object getFeature(String name)
name
- the name of the featurevoid decode()
void addPaths(ClusterUnitSelector.ViterbiPoint point, ClusterUnitSelector.ViterbiPath path)
point
- the point to add the paths topaths
- the pathvoid addPath(ClusterUnitSelector.ViterbiPoint point, ClusterUnitSelector.ViterbiPath newPath)
point
- where the path is addednewPath
- the path to add if its score is bestprivate boolean isBetterThan(int a, int b)
a
- value to checkb
- value to check.
return true if a is better than b.boolean result(String feature)
feature
- the feature to addvoid copyFeature(String feature)
feature
- the name of the feature.private ClusterUnitSelector.ViterbiCandidate getCandidate(Item item)
private ClusterUnitSelector.ViterbiPath getPath(ClusterUnitSelector.ViterbiPath path, ClusterUnitSelector.ViterbiCandidate candidate)
path
- the previous path, or null if this candidate starts a new pathcandiate
- the candidate to add to the pathprivate ClusterUnitSelector.ViterbiPath findBestPath()
Cost getOptimalCouple(int u0, int u1)
u0
- first unit to tryu1
- second unit to tryint getOptimalCoupleFrame(int u0, int u1)
u0
- the first unit to tryu1
- the second unit to trypublic int getFrameDistance(int a, int b, int[] joinWeights, int order)
a
- first frameb
- second framejoinWeights
- the weights used in comparisonorder
- number of comparesWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses