Class: OpenNlp::Categorizer
Instance Attribute Summary
Attributes inherited from Tool
Instance Method Summary collapse
-
#categorize(str) ⇒ String
Categorizes a string passed as parameter to one of the categories.
Methods inherited from Tool
Methods included from JavaClass
Constructor Details
This class inherits a constructor from OpenNlp::Tool
Instance Method Details
#categorize(str) ⇒ String
Categorizes a string passed as parameter to one of the categories
9 10 11 12 13 14 |
# File 'lib/open_nlp/categorizer.rb', line 9 def categorize(str) fail ArgumentError, 'str param must be a String' unless str.is_a?(String) outcomes = j_instance.categorize(str) j_instance.getBestCategory(outcomes) end |