arch
Class Polyphone

java.lang.Object
  extended by arch.Polyphone
All Implemented Interfaces:
java.io.Serializable

public class Polyphone
extends java.lang.Object
implements java.io.Serializable

A polyphone consists of a central phone, its left and right context and the statistical models linked to it. The polyphone inventory is fixed, the tree structure references to these instances on demand.

Author:
sikoried
See Also:
Serialized Form

Field Summary
 HMM hmm
          acoustic model associated with this polyphone
 long INSTANCE_ID
          unique ID
 int occurrences
          number of occurrences in the training set
static java.lang.String SB
          syllable boundary
static java.lang.String WB
          word boundary
 
Constructor Summary
Polyphone(java.lang.String monophone)
          Create a monophone without context.
Polyphone(java.lang.String[] left, java.lang.String phone, java.lang.String[] right)
          Create a polyphone with the given context.
 
Method Summary
 void addChild(Polyphone child)
          Add a Polyphone to the hierarchy
 boolean equals(java.lang.Object o)
           
 boolean equals(Polyphone p)
           
 boolean equals(java.lang.String phoneInContext)
           
static Polyphone[] extractPolyphonesFromWordTranscription(java.lang.String[] trans)
          Extract all possible polyphones from the given word transcription.
 boolean generalizes(Polyphone p)
          Check whether or not the polyphone generalizes the referenced polyphone NB: An equal polyphone is not a generalization!
 int hashCode()
          Obtain a hash value using the string representation of the polyphone
 java.lang.String hierarchyAsDotFormat(boolean includeHeader)
          Generate a String representation of the hierarchy using the .dot format
 java.lang.String hierarchyAsString()
          Generate a String representation of the hierarchy using ASCII art
 boolean isBiphone()
           
 boolean isMonophone()
           
 boolean isTriphone()
           
 boolean matchesTranscription(java.lang.String[] transcription, int position)
          Check if the the polyphone and its context matches a transcription at a given point
 void pruneHierarchy()
          Prune the phoneme hierarchy to remove extra "idle" links.
 void pruneHierarchyByOccurrence(int minOcc)
          Prune the phoneme hierarchy by removing polyphones appearing less than minOcc times (recursive call).
 void resetOccurrenceCounter()
          Reset the occurrence counter of this polyphone and its children
 boolean specializes(Polyphone p)
          Check whether or not the polyphone specializes the referenced polyphone.
 java.lang.String toString()
          Obtain a string representation of the polyphone, e.g.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hmm

public HMM hmm
acoustic model associated with this polyphone


INSTANCE_ID

public final long INSTANCE_ID
unique ID


occurrences

public int occurrences
number of occurrences in the training set


SB

public static final java.lang.String SB
syllable boundary

See Also:
Constant Field Values

WB

public static final java.lang.String WB
word boundary

See Also:
Constant Field Values
Constructor Detail

Polyphone

public Polyphone(java.lang.String monophone)
Create a monophone without context.

Parameters:
monophone -

Polyphone

public Polyphone(java.lang.String[] left,
                 java.lang.String phone,
                 java.lang.String[] right)
Create a polyphone with the given context.

Parameters:
left -
phone -
right -
Method Detail

addChild

public void addChild(Polyphone child)
Add a Polyphone to the hierarchy

Parameters:
child -

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

equals

public boolean equals(Polyphone p)

equals

public boolean equals(java.lang.String phoneInContext)

extractPolyphonesFromWordTranscription

public static Polyphone[] extractPolyphonesFromWordTranscription(java.lang.String[] trans)
Extract all possible polyphones from the given word transcription.

Parameters:
trans - Transcription of a single word in form of a String array of phonemes. Make sure you have leading and trailing word boundaries and syllabe boundaries (if desired).
Returns:
Array of polyphones (not linked)

generalizes

public boolean generalizes(Polyphone p)
Check whether or not the polyphone generalizes the referenced polyphone NB: An equal polyphone is not a generalization!

Parameters:
p -
Returns:

hashCode

public int hashCode()
Obtain a hash value using the string representation of the polyphone

Overrides:
hashCode in class java.lang.Object

hierarchyAsDotFormat

public java.lang.String hierarchyAsDotFormat(boolean includeHeader)
Generate a String representation of the hierarchy using the .dot format

Returns:
.dot graph without header

hierarchyAsString

public java.lang.String hierarchyAsString()
Generate a String representation of the hierarchy using ASCII art

Returns:

isBiphone

public boolean isBiphone()

isMonophone

public boolean isMonophone()

isTriphone

public boolean isTriphone()

matchesTranscription

public boolean matchesTranscription(java.lang.String[] transcription,
                                    int position)
Check if the the polyphone and its context matches a transcription at a given point

Parameters:
transcription - transcription of the target word
position - index of the central phone
Returns:
true if the polyphone matches the position

pruneHierarchy

public void pruneHierarchy()
Prune the phoneme hierarchy to remove extra "idle" links. This is handled through recursion!


pruneHierarchyByOccurrence

public void pruneHierarchyByOccurrence(int minOcc)
Prune the phoneme hierarchy by removing polyphones appearing less than minOcc times (recursive call).

Parameters:
minOcc - minimum number of occurrences

resetOccurrenceCounter

public void resetOccurrenceCounter()
Reset the occurrence counter of this polyphone and its children


specializes

public boolean specializes(Polyphone p)
Check whether or not the polyphone specializes the referenced polyphone. NB: An equal polyphone is not a specialization!

Parameters:
p -
Returns:

toString

public java.lang.String toString()
Obtain a string representation of the polyphone, e.g. raI/s/@

Overrides:
toString in class java.lang.Object