Java Reference
In-Depth Information
Method
Meaning
getOutcomes Returns a list of strings representing the tags for the sentence
Returns an array of double variables representing the probability for each tag in the sequence
getProbs
getScore
Returns a weighted value for the sequence
In the following sequence, we use several of these methods to demonstrate what they do.
For each sequence, the tags and their probability are displayed, separated by a forward
slash:
for (int i = 0; i<topSequences.length; i++) {
List<String> outcomes = topSequences[i].getOutcomes();
double probabilities[] = topSequences[i].getProbs();
for (int j = 0; j <outcomes.size(); j++) {
System.out.printf("%s/%5.3f ",outcomes.get(j),
probabilities[j]);
}
System.out.println();
}
System.out.println();
The output is as follows. Each pair of lines represents one sequence where the output has
been wrapped:
DT/0.992 NN/0.990 IN/0.989 DT/0.990 NNP/0.996 NNP/0.991 VBD/
0.994 IN/0.996 DT/0.996 JJ/0.991 NN/0.994 VBN/0.860 IN/
0.985 DT/0.960 JJ/0.919 NN/0.832
DT/0.992 NN/0.990 IN/0.989 DT/0.990 NNP/0.996 NNP/0.991 VBD/
0.994 IN/0.996 DT/0.996 JJ/0.991 NN/0.994 VBN/0.860 IN/
0.985 DT/0.960 JJ/0.919 ./0.073
DT/0.992 NN/0.990 IN/0.989 DT/0.990 NNP/0.996 NNP/0.991 VBD/
0.994 IN/0.996 DT/0.996 JJ/0.991 NN/0.994 VBN/0.860 IN/
0.985 DT/0.960 NN/0.073 NN/0.419
Search WWH ::




Custom Search