Java Reference
In-Depth Information
+ "(or its dilute blue) mottled throughout the
coat.";
Using the text for toto , we get the following output. This suggests that the text should be
placed in the dog category:
dog - 0.5870711529777994
cat - 0.41292884702220056
Using calico instead yields these results:
dog - 0.28960436044424276
cat - 0.7103956395557574
We could have used the getBestCategory method to return only the best category.
This method uses the array of outcomes and returns a string. The getAllResults
method will return all of the results as a string. These two methods are illustrated here:
System.out.println(categorizer.getBestCategory(outcomes));
System.out.println(categorizer.getAllResults(outcomes));
The output will be as follows:
cat
dog[0.2896] cat[0.7104]
Search WWH ::




Custom Search