3 # Copyright (C) 2001 Yoshito Komatsu
4 # 2014 Mitsutoshi NAKANO <bkbin005@rinku.zaq.ne.jp>
5 # This program is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published
7 # by the Free Software Foundation; either version 2 of the License,
8 # or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE.
13 # See the GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to
17 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 # yu2.PL - convert CSV file to Canna|Wnn dictionary
34 print STDERR "usage: yu2.PL [--yubin KEN_ALL.CSV] [--jigyosho JIGYOSYO.CSV] [--ime={canna|wnn}]";
38 sub printCANNAyubin($$)
40 my ($seven, $jusho) = @_;
41 print "${seven} \#CN ${jusho}\n";
44 sub printCANNAjigyosho($$$)
46 my ($seven, $jigyosho, $jusho) = @_;
47 print "${seven} \#CN ${jigyosho} ${jusho}\n";
52 my ($seven, $jusho) = @_;
53 print "${seven} ${jusho} 地名 0\n";
57 sub printWNNjigyosho($$$)
59 my ($seven, $jigyosho, $jusho) = @_;
60 print "${seven} ${jigyosho} 地名 0\n";
61 print "${seven} ${jusho} 地名 0\n";
66 my ($yubin, $jigyosho, $ime) = ('./KEN_ALL.CSV', './JIGYOSYO.CSV', CANNA);
69 "jigyosho=s" => \$jigyosho,
73 my ($printlineYubin, $printlineJigyosho)
74 = (\&printCANNAyubin, \&printCANNAjigyosho);
76 $printlineYubin = \&printWNNyubin;
77 $printlineJigyosho = \&printWNNjigyosho
78 } elsif ("$ime" eq CANNA) {
82 binmode STDOUT, ':encoding(EUC-JP)';
85 binmode CSV, ':encoding(Shift_JIS)';
88 my @tmp = split (/\,/, $_);
89 &$printlineYubin($tmp[2], "$tmp[6]$tmp[7]$tmp[8]");
94 binmode CSV, ':encoding(Shift_JIS)';
97 my @tmp = split (/\,/, $_);
98 &$printlineJigyosho("$tmp[7]", "$tmp[2]", "$tmp[3]$tmp[4]$tmp[5]$tmp[6]");