Skip to content

Instantly share code, notes, and snippets.

@lopnor
Created June 17, 2009 07:14
Show Gist options
  • Save lopnor/131117 to your computer and use it in GitHub Desktop.
Save lopnor/131117 to your computer and use it in GitHub Desktop.
#!perl
use strict;
use warnings;
use utf8;
use Text::MeCab;
use Encode ();
my $input = Encode::decode('utf-8', $ARGV[0]);
my $mecab = Text::MeCab->new({
userdic => 'mydic.dic',
node_format => '%f[9]',
});
for (my $node = $mecab->parse($input); $node; $node = $node->next) {
Encode::decode('utf-8', $node->format($mecab)) eq '俺専用' or next;
warn $node->surface;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment