alignWords(backtrace(createBacktraceTable(referenceItems,
hypothesisItems, new Comparator () {
public boolean isSimilar(Object refObject, Object hypObject) {
if (refObject instanceof String && hypObject instanceof ConfusionSet) {
String ref = (String)refObject;
ConfusionSet set = (ConfusionSet)hypObject;
if (set.containsWord(ref)) {
return true;
}
}
return false;
}
})), new StringRenderer() {
public String getRef(Object ref, Object hyp) {
return (String)ref;
}
public String getHyp(Object refObject, Object hypObject) {
String ref = (String)refObject;
ConfusionSet set = (ConfusionSet)hypObject;
if (set.containsWord(ref))
return ref;
String res = set.getBestHypothesis().toString();
return res;
}
});
// Compute the number of correct words in the hypothesis.