Wakame
Documentation for Wakame.
Installation
To install Wakame either do
using Pkg
Pkg.add("Wakame")or switch to Pkg mode with ] and issue
pkg> add WakameRequirement
This package requires the following software to be installed:
- mecab
- dictionary for mecab (such as mecab-ipadic, mecab-naist-jdic, and others)
Usage
using Wakame
# Create a mecab tagger
mecab = Mecab()
# You can give MeCab option like "-o wakati"
# mecab = Mecab("-o wakati")
# Parse text. It returns Array of MecabNode type
results = parse(mecab, "すももももももももものうち")
# Access each result. It returns Array of String
for result in results
println(result.surface, ":", result.feature)
end
# Parse surface
results = parse_surface(mecab, "すももももももももものうち")
# Access each result. It returns Array of Array of MecabNode
for result in results
println(result)
end
# Parse nbest result
nbest_results = parse_nbest(mecab, 3, "すももももももももものうち")
for nbest_result in nbest_results
for result in nbest_result
println(result.surface, ":", result.feature)
end
println()
endCredits
Reboot of MeCab.jl created by Michiaki Ariga
Original MeCab is created by Taku Kudo
Contributors
Wakame.MecabWakame.MecabNodeWakame.MecabRawNodeBase.parseWakame.create_mecab_resultsWakame.create_nodeWakame.create_nodesWakame.create_surfaceWakame.create_surfacesWakame.mecab_resultWakame.mecab_sparse_tonodeWakame.nbest_initWakame.nbest_next_tostrWakame.nbest_sparse_tostrWakame.parse_nbestWakame.parse_surfaceWakame.parse_surface2Wakame.sparse_tostr
Wakame.Mecab — TypeMecabA mutable struct representing a MeCab tagger. It is created by calling the Mecab() constructor.
Examples
tagger = Mecab()
results = parse(mecab, "すももももももももものうち")Wakame.MecabNode — TypeA mutable struct representing a MeCab node.Wakame.MecabRawNode — TypeA mutable struct representing a raw node in MeCab used to create a `MecabNode`Base.parse — MethodParse a string using a `Mecab` tagger and return result as an `Array{MecabNode}`Wakame.create_mecab_results — MethodCreate an array of `MecabNode` from an array of MeCab resultsWakame.create_node — MethodFunction to create a `MecabNode` from a `MecabRawNode`Wakame.create_nodes — MethodFunction to create an `Array{MecabNode}` from a `Ptr{MecabRawNode}`Wakame.create_surface — MethodFunction to create a `String` from a `MecabRawNode`Wakame.create_surfaces — MethodFunction to create an `Array{String}` from a `Ptr{MecabRawNode}`Wakame.mecab_result — MethodCreate a `MecabNode` from a MeCab resultWakame.mecab_sparse_tonode — MethodParse a string using a `Mecab` tagger and return result as a `Ptr{MecabRawNode}`Wakame.nbest_init — MethodInitialize the n-best enumeration process for a `Mecab` taggerWakame.nbest_next_tostr — MethodGet the next n-best result from a `Mecab` taggerWakame.nbest_sparse_tostr — MethodParse a string using a `Mecab` tagger and return top n results as a stringWakame.parse_nbest — MethodParse a string using a `Mecab` tagger and return the top n results as an `Array{Array{MecabNode}}`Wakame.parse_surface — MethodParse a string using a `Mecab` tagger and return surface strings as an `Array{String}`Wakame.parse_surface2 — MethodParse a string using a `Mecab` tagger and return surface strings as an `Array{String}`Wakame.sparse_tostr — MethodParse a string using a `Mecab` tagger and return result as a string