issco.eval
Class WordErrorRate

java.lang.Object
  extended by issco.eval.WordErrorRate
All Implemented Interfaces:
ErrorRate

public class WordErrorRate
extends java.lang.Object
implements ErrorRate

Class useful for computing Word Error Rate. The "computeNumerator" method computes the total number of word deletions, insertions and substitutions required in order to obtain the "reference" (ref) data starting from "hypothetised" (hyp) data.

Author:
Maria GEORGESCUL, ISSCO/TIM, ETI, UNIVERSITY OF GENEVA

Field Summary
(package private)  java.lang.String[] hyp
           
(package private)  java.lang.String[] ref
           
(package private)  java.lang.String wordDeliminator
           
 
Constructor Summary
WordErrorRate()
          Deprecated. Use WordErrorRate(String refStr, String hypStr, String wordDeliminator) instead
WordErrorRate(java.lang.String refStr, java.lang.String hypStr, java.lang.String wordDeliminator)
           
 
Method Summary
 float computeDenominator()
          Computes word error rate denominator, i.e.
 float computeNumerator()
          Computes the numerator for word error rate.
 java.lang.String[] getHyp()
           
 java.lang.String[] getRef()
           
static void main(java.lang.String[] args)
          WordErrorRate's main can be called with two arguments of type String and containing:
1) the reference utterancel;
2) the hypothetised utterance.
 void setHyp(java.lang.String hypStr)
          Sets the value of the 'Hyp' attribute.
 void setRef(java.lang.String refStr)
          Sets the value of the 'Ref' attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wordDeliminator

java.lang.String wordDeliminator

ref

java.lang.String[] ref

hyp

java.lang.String[] hyp
Constructor Detail

WordErrorRate

public WordErrorRate()
Deprecated. Use WordErrorRate(String refStr, String hypStr, String wordDeliminator) instead


WordErrorRate

public WordErrorRate(java.lang.String refStr,
                     java.lang.String hypStr,
                     java.lang.String wordDeliminator)
Parameters:
refStr - - reference utterance, where each two words are separated by a string specified by wordDeliminator
hypStr - - hypothetised utterance, where each two words are separated by a a string specified by wordDeliminator.
wordDeliminator - - A string or a character (e.g. a space, a comma, etc.) used to delimit text into words.
Method Detail

computeDenominator

public float computeDenominator()
Computes word error rate denominator, i.e. the number of words contained by the reference utterance.

Specified by:
computeDenominator in interface ErrorRate
Returns:
the length of the reference utterance.

computeNumerator

public float computeNumerator()
Computes the numerator for word error rate.
The algorithm requires only O(n^2) iterations, where n=max{ref.length, hyp.length}.

Specified by:
computeNumerator in interface ErrorRate
Returns:
the total number of word deletions, insertions and substitutions required in order to obtain the "reference" (ref) data starting from "hypothetised" (hyp) data.

getHyp

public java.lang.String[] getHyp()
Specified by:
getHyp in interface ErrorRate

getRef

public java.lang.String[] getRef()
Specified by:
getRef in interface ErrorRate

setHyp

public void setHyp(java.lang.String hypStr)
Description copied from interface: ErrorRate
Sets the value of the 'Hyp' attribute.

Specified by:
setHyp in interface ErrorRate
Parameters:
hypStr - the new value of the 'Hyp' attribute.
See Also:
ErrorRate.getHyp()

setRef

public void setRef(java.lang.String refStr)
Description copied from interface: ErrorRate
Sets the value of the 'Ref' attribute.

Specified by:
setRef in interface ErrorRate
Parameters:
refStr - the new value of the 'Ref' attribute.
See Also:
ErrorRate.getRef()

main

public static void main(java.lang.String[] args)
WordErrorRate's main can be called with two arguments of type String and containing:
1) the reference utterancel;
2) the hypothetised utterance.

Parameters:
args -