[![Build Status](https://travis-ci.org/titsuki/p6-MeCab.svg?branch=master)](https://travis-ci.org/titsuki/p6-MeCab) NAME ==== MeCab - A Perl 6 bindings for libmecab ( http://taku910.github.io/mecab/ ) SYNOPSIS ======== EXAMPLE 1 --------- use MeCab; use MeCab::Tagger; my Str $text = "ã™ã‚‚ã‚‚ã‚‚ã‚‚ã‚‚ã‚‚ã‚‚ã‚‚ã®ã†ã¡ã€‚"; my $mecab-tagger = MeCab::Tagger.new('-C'); loop ( my MeCab::Node $node = $mecab-tagger.parse-tonode($text); $node; $node = $node.next ) { say ($node.surface, $node.feature).join("\t"); } # OUTPUT« # BOS/EOS,*,*,*,*,*,*,*,* # ã™ã‚‚ã‚‚ åè©ž,一般,*,*,*,*,ã™ã‚‚ã‚‚,スモモ,スモモ # ã‚‚ 助詞,係助詞,*,*,*,*,ã‚‚,モ,モ # ã‚‚ã‚‚ åè©ž,一般,*,*,*,*,ã‚‚ã‚‚,モモ,モモ # ã‚‚ 助詞,係助詞,*,*,*,*,ã‚‚,モ,モ # ã‚‚ã‚‚ åè©ž,一般,*,*,*,*,ã‚‚ã‚‚,モモ,モモ # 㮠助詞,連体化,*,*,*,*,ã®,ノ,ノ # ã†ã¡ åè©ž,éžè‡ªç«‹,副詞å¯èƒ½,*,*,*,ã†ã¡,ウãƒ,ウム# 。 記å·,å¥ç‚¹,*,*,*,*,。,。,。 # BOS/EOS,*,*,*,*,*,*,*,* # » EXAMPLE 2 --------- use MeCab; use MeCab::Lattice; use MeCab::Tagger; use MeCab::Model; my MeCab::Model $model .= new; my MeCab::Tagger $tagger = $model.create-tagger; my MeCab::Lattice $lattice = $model.create-lattice; $lattice.add-request-type(MECAB_NBEST); $lattice.sentence("今日も"); if $tagger.parse($lattice) { say $lattice.nbest-tostr(2); } # OUTPUT« # 今日 åè©ž,副詞å¯èƒ½,*,*,*,*,今日,ã‚ョウ,ã‚ョー # ã‚‚ 助詞,係助詞,*,*,*,*,ã‚‚,モ,モ # EOS # 今日 åè©ž,副詞å¯èƒ½,*,*,*,*,今日,コンニãƒ,コンニム# ã‚‚ 助詞,係助詞,*,*,*,*,ã‚‚,モ,モ # EOS # » DESCRIPTION =========== MeCab is a Perl 6 bindings for libmecab ( http://taku910.github.io/mecab/ ). NOTICE ====== COMPATIBILITY ------------- MeCab currently doesn't support Windows. It supports Linux/Unix or Mac OS X. BUILDING MeCab -------------- MeCab depends on the following: * wget * mecab-0.996 * mecab-ipadic-2.7.0-20070801 Once the build starts, it automatically downloads `mecab-0.996` and `mecab-ipadic-2.7.0-20070801` with `wget` and installs these stuffs under the `$HOME/.p6mecab` directory, where `$HOME` is your home directory. Use 3rd-party dictionary ======================== mecab-ipadic-neologd -------------------- * Step1: download and install neologd Example: $ git clone --depth 1 https://github.com/neologd/mecab-ipadic-neologd.git $ cd mecab-ipadic-neologd $ export PATH=$HOME/.p6mecab/bin:$PATH $ ./bin/install-mecab-ipadic-neologd -p $HOME/.p6mecab/lib/mecab/dic/ipadic-neologd * Step2: Use .new(:dicdir(PATH_TO_THE_DIR)) Example: use MeCab; use MeCab::Tagger; my Str $text = "ãƒˆãƒ©ãƒ³ãƒ—å¤§çµ±é ˜ ワシントンã§å¤§è¦æ¨¡è»äº‹ãƒ‘レードを指示"; my $mecab-tagger = MeCab::Tagger.new(:dicdir("$*HOME/.p6mecab/lib/mecab/dic/ipadic-neologd")); loop ( my MeCab::Node $node = $mecab-tagger.parse-tonode($text); $node; $node = $node.next ) { say ($node.surface, $node.feature).join("\t"); } # OUTPUT« # BOS/EOS,*,*,*,*,*,*,*,* # ãƒˆãƒ©ãƒ³ãƒ—å¤§çµ±é ˜ åè©ž,固有åè©ž,人å,一般,*,*,ドナルド・トランプ,トランプダイトウリョウ,トランプダイトウリョー # ワシントン åè©ž,固有åè©ž,地域,一般,*,*,ワシントン,ワシントン,ワシントン # 㧠助詞,æ ¼åŠ©è©ž,一般,*,*,*,ã§,デ,デ # 大è¦æ¨¡ åè©ž,一般,*,*,*,*,大è¦æ¨¡,ダイã‚ボ,ダイã‚ボ # è»äº‹ãƒ‘レード åè©ž,固有åè©ž,一般,*,*,*,è»äº‹ãƒ‘レード,グンジパレード,グンジパレード # ã‚’ 助詞,æ ¼åŠ©è©ž,一般,*,*,*,ã‚’,ヲ,ヲ # 指示 åè©ž,サ変接続,*,*,*,*,指示,シジ,シジ # BOS/EOS,*,*,*,*,*,*,*,* # » AUTHOR ====== titsuki <titsuki@cpan.org> COPYRIGHT AND LICENSE ===================== Copyright 2016 titsuki libmecab ( http://taku910.github.io/mecab/ ) by Taku Kudo is licensed under the GPL, LGPL or BSD Licenses. This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.