class Fluent::KuromojiOutput

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_kuromoji.rb, line 15
def initialize
  super
  require 'kuromoji'
end

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_kuromoji.rb, line 20
def configure(conf)
  super
  @core = Kuromoji::Core.new(@dictionary_path)
end
emit(tag, es, chain) click to toggle source
# File lib/fluent/plugin/out_kuromoji.rb, line 25
def emit(tag, es, chain)
  es.each do |time, record|
    tokens = @core.tokenize_with_hash(record[@target_key])
    tokens.each do |token|
      router.emit(@add_tag_prefix + '.' + tag, time, token)
    end
  end
  chain.next
end