Java Reference
In-Depth Information
while (iterator.hasNext()) {
ScoredTagging<String> scoredTagging = iterator.next();
System.out.printf("Score: %7.3f Sequence: ",
scoredTagging.score());
for (int i = 0; i < tokenList.size(); ++i) {
System.out.print(scoredTagging.token(i) + "/"
+ scoredTagging.tag(i) + " ");
}
System.out.println();
}
The output is as follows. Notice that the word "force" can have a tag of nn , jj , or vb :
Score: -148.796 Sequence: Bill/np used/vbd the/at force/
nn to/to force/vb the/at manager/nn to/to tear/vb the/at
bill/nn in/in two./nn
Score: -154.434 Sequence: Bill/np used/vbn the/at force/
nn to/to force/vb the/at manager/nn to/to tear/vb the/at
bill/nn in/in two./nn
Score: -154.781 Sequence: Bill/np used/vbd the/at force/
nn to/in force/nn the/at manager/nn to/to tear/vb the/at
bill/nn in/in two./nn
Score: -157.126 Sequence: Bill/np used/vbd the/at force/
nn to/to force/vb the/at manager/jj to/to tear/vb the/at
bill/nn in/in two./nn
Score: -157.340 Sequence: Bill/np used/vbd the/at force/
jj to/to force/vb the/at manager/nn to/to tear/vb the/at
bill/nn in/in two./nn
Determining tag confidence with the HmmDecoder class
Statistical analysis can be performed using a lattice structure, which is useful for analyz-
ing alternative word orderings. This structure represents forward/backward scores. The
HmmDecoder class' tagMarginal method returns an instance of a TagLattice
class, which represents a lattice.
We can examine each token of the lattice using an instance of the ConditionalClas-
sification class. In the following example, the tagMarginal method returns a
Search WWH ::




Custom Search