Created
November 21, 2011 10:02
-
-
Save kurain/1382199 to your computer and use it in GitHub Desktop.
To listen the IRC log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use warnings; | |
use strict; | |
use Text::MeCab; | |
use Perl6::Say; | |
my $mecab = Text::MeCab->new; | |
while(<>){ | |
chomp; | |
my (undef,undef, @elms) = split ' ', $_; | |
my $text = join "", @elms; | |
my $node = $mecab->parse($text); | |
my $res = ""; | |
while ($node) { | |
my @features = split ',', $node->feature; | |
my $pronaunce = $features[$#features]; | |
$pronaunce = $node->surface if $pronaunce eq '*'; | |
$res .= $pronaunce if $pronaunce; | |
$node = $node->next | |
} | |
say $res; | |
system "/usr/local/bin/SayKana $res"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment