Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 23 lines (17 sloc) 0.551 kb
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Lingua::JA::Romanize::Japanese;
use Lingua::JP::Kanjidic;
use Encode 'decode_utf8';
my $dic = Lingua::JP::Kanjidic->new("$ENV{HOME}/.kanjidic");
$\ = "\n";
my $text = decode_utf8 "@ARGV";
binmode(\*STDOUT, ':utf8');
print Lingua::JA::Romanize::Japanese->new->chars($text);
if ($text =~ /^\p{Han}$/) {
my $entry = $dic->lookup($text) or exit;
print join '', @{ $entry->{katakana} } if $entry->{katakana};
print join '', @{ $entry->{hiragana} } if $entry->{hiragana};
}
Jump to Line
Something went wrong with that request. Please try again.