Sha256: 5ae7f4ec39511c11bb4c4aa86fb622197ab1c75e43bf8aba92f832b9da9338b1
Contents?: true
Size: 484 Bytes
Versions: 2
Compression:
Stored size: 484 Bytes
Contents
module OpenNlp class Categorizer < Tool self.java_class = Java::opennlp.tools.doccat.DocumentCategorizerME # Categorizes a string passed as parameter to one of the categories # # @param [String] str string to be categorized # @return [String] category 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
open_nlp-0.2.0-java | lib/open_nlp/categorizer.rb |
open_nlp-0.1.0-java | lib/open_nlp/categorizer.rb |