Skip to content

Commit

Permalink
Merge pull request #6 from titsuki/add-mecab-tagger-new
Browse files Browse the repository at this point in the history
Make MeCab::Tagger.new multi method
  • Loading branch information
titsuki authored Nov 17, 2016
2 parents f92ab0e + 2e896f2 commit ebcd1c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/MeCab/Tagger.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ my sub mecab_sparse_tostr3(MeCab::Tagger, size_t, Str, size_t, CArray[int8], siz
my sub mecab_dictionary_info(MeCab::Tagger) returns MeCab::DictionaryInfo is native($library) { * }
my sub mecab_strerror(MeCab::Tagger) returns Str is native($library) { * }

method new(Str $arg) {
multi method new(Str $arg) {
mecab_new2($arg);
}

multi method new {
mecab_new2("-C");
}

method version {
mecab_version();
}
Expand Down
2 changes: 2 additions & 0 deletions t/01-tagger.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use MeCab::Tagger;

lives-ok { my $mecab-tagger = MeCab::Tagger.new('-C'); }

lives-ok { my $mecab-tagger = MeCab::Tagger.new; }

subtest {
{
my Str $text = "すもももももももものうち。";
Expand Down

0 comments on commit ebcd1c8

Please sign in to comment.