Class: Fluent::KuromojiOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::KuromojiOutput
- Defined in:
- lib/fluent/plugin/out_kuromoji.rb
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #emit(tag, es, chain) ⇒ Object
-
#initialize ⇒ KuromojiOutput
constructor
A new instance of KuromojiOutput.
Constructor Details
#initialize ⇒ KuromojiOutput
Returns a new instance of KuromojiOutput.
10 11 12 13 |
# File 'lib/fluent/plugin/out_kuromoji.rb', line 10 def initialize super require 'kuromoji' end |
Instance Method Details
#configure(conf) ⇒ Object
15 16 17 18 |
# File 'lib/fluent/plugin/out_kuromoji.rb', line 15 def configure(conf) super @core = Kuromoji::Core.new(@dictionary_path) end |
#emit(tag, es, chain) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/fluent/plugin/out_kuromoji.rb', line 20 def emit(tag, es, chain) es.each do |time, record| tokens = @core.tokenize_with_hash(record[@target_key]) tokens.each do |token| Fluent::Engine.emit(@add_tag_prefix + '.' + tag, time, token) end end chain.next end |