Sha256: d34a6ae7cae124c4f825a085e3c92412e2451a442c5b9f240b55b54da3f98b22
Contents?: true
Size: 837 Bytes
Versions: 1
Compression:
Stored size: 837 Bytes
Contents
# coding: UTF-8 module Fluent class KuromojiOutput < Output Fluent::Plugin.register_output('kuromoji', self) # Define `router` method of v0.12 to support v0.10 or earlier unless method_defined?(:router) define_method("router") { Fluent::Engine } end config_param :target_key, :string config_param :add_tag_prefix, :string config_param :dictionary_path, :string def initialize super require 'kuromoji' end def configure(conf) super @core = Kuromoji::Core.new(@dictionary_path) end 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-kuromoji-0.0.2 | lib/fluent/plugin/out_kuromoji.rb |