[![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,*,*,*,*,*,*,*,* # �踺���� ��滩��,銝���,*,*,*,*,�踺����,�嫘�U��,�嫘�U�� # �� �𨭌閰�,靽��𨭌閰�,*,*,*,*,��,��,�� # ���� ��滩��,銝���,*,*,*,*,����,�U��,�U�� # �� �𨭌閰�,靽��𨭌閰�,*,*,*,*,��,��,�� # ���� ��滩��,銝���,*,*,*,*,����,�U��,�U�� # �� �𨭌閰�,���枏��,*,*,*,*,��,��,�� # ���� ��滩��,��噼䌊蝡�,��閰𧼮虾��,*,*,*,����,�艾��,�艾�� # �� 閮睃噡,�蘂��,*,*,*,*,��,��,�� # 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.