Class: KyTea
- Inherits:
-
Object
- Object
- KyTea
- Defined in:
- lib/kytea.rb
Instance Method Summary collapse
-
#initialize(option = "") ⇒ KyTea
constructor
A new instance of KyTea.
- #segment(input) ⇒ Object
- #tag_info_of(input) ⇒ Object
- #tags_of(input, full_tag: false) ⇒ Object
Constructor Details
Instance Method Details
#segment(input) ⇒ Object
9 10 11 12 13 |
# File 'lib/kytea.rb', line 9 def segment(input) @model.getWS(input).map do |word| word.force_encoding(Encoding.default_external) end end |
#tag_info_of(input) ⇒ Object
15 16 17 |
# File 'lib/kytea.rb', line 15 def tag_info_of(input) @model.getTagsToString(input).force_encoding(Encoding.default_external) end |
#tags_of(input, full_tag: false) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/kytea.rb', line 19 def (input, full_tag: false) = full_tag ? @model.getAllTags(input) : @model.getTags(input) .map do |e| = e.tag.map do |t| t.map do |k, v| { tag: k.force_encoding("UTF-8"), val: v } end end { surface: e.surface.force_encoding("UTF-8"), tags: } end end |