Sha256: b310c4109b3fa75f33b67d34aedc55bc56466fda624897e6456991a77e4ebf79

Contents?: true

Size: 586 Bytes

Versions: 4

Compression:

Stored size: 586 Bytes

Contents

require 'java'
require ::File.join(::File.dirname(__FILE__), "..", "..", "target" , "bae.jar")

module Bae
  class NativeClassifier

    attr_reader :internal_classifier

    def initialize
      @internal_classifier = ::Java::Bae::NaiveBayesClassifier.new
    end

    def train(label, feature)
      internal_classifier.train(label, ::Java::Bae::Document.new(feature))
    end

    def classify(feature)
      internal_classifier.classify(::Java::Bae::Document.new(feature))
    end

    def finish_training!
      internal_classifier.calculateInitialLikelihoods()
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bae-0.2.0 lib/bae/native_classifier.rb
bae-0.1.0 lib/bae/native_classifier.rb
bae-0.0.9 lib/bae/native_classifier.rb
bae-0.0.8-java lib/bae/native_classifier.rb