crystal-fucoidan
forked from lpm11/crystal-fucoidancrystal-fucoidan

crystal-mecab wrapper.
Usage
Make Projectfile like this to tell crystal about dependencies.
deps do
github "lpm11/crystal-mecab"
github "lpm11/crystal-fucoidan"
end
Run crystal deps
enables us to use basic functions of MeCab in crystal like this.
require "fucoidan"
# Segments sentence into words
f = Fucoidan::Fucoidan.new("-O wakati")
puts(f.parse("すもももももももものうち")) # => すもも も もも も もも の うち
# Segments sentence into nodes
f = Fucoidan::Fucoidan.new("")
f.parse("すもももももももものうち") { |node|
puts("#{node.surface}\t#{node.feature}")
}
# Extract noun words
words = f.enum_parse("すもももももももものうち")
.select { |node| node.feature.starts_with?("名詞") }
.map { |node| node.surface }
puts(words.join(", ")) # => すもも, もも, もも, うち
License
Repository
crystal-fucoidan
Owner
Statistic
- 0
- 0
- 0
- 1
- 1
- over 2 years ago
- November 25, 2022
License
MIT License
Links
Synced at
Sun, 22 Jun 2025 15:56:12 GMT
Languages