Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 56 lines (48 sloc) 1.447 kB
cf60c28 @mskala Initial import from Sourceforge.JP SVN
authored
1 #!/usr/bin/perl -CDS
2
3 # EDICT2 to IDSgrep EIDS translator
4 # Copyright (C) 2012 Matthew Skala
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, version 3.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #
18 # Matthew Skala
19 # http://ansuz.sooke.bc.ca/
20 # mskala@ansuz.sooke.bc.ca
21
22 use utf8;
23
bce8d03 @mskala more CHISE IDS stuff for IDSgrep
authored
24 $svnid='$Id: ed22eids 1559 2012-07-20 19:01:41Z mskala $';
cf60c28 @mskala Initial import from Sourceforge.JP SVN
authored
25
26 # FIXME pass through copyright notices
27
28 # characters that are special to EIDS and must be quoted
29 $kvg{''}='<・>;';
30
bce8d03 @mskala more CHISE IDS stuff for IDSgrep
authored
31 if (@ARGV) {
32 $decomp_file=shift;
33 open(KVG,$decomp_file);
34 while (<KVG>) {
35 chomp;
36 if (/^【(.*)】(.*)$/ && ($2 ne ';')) {
37 $kvg{$1}="<$1>$2";
38 }
cf60c28 @mskala Initial import from Sourceforge.JP SVN
authored
39 }
bce8d03 @mskala more CHISE IDS stuff for IDSgrep
authored
40 close(KVG);
cf60c28 @mskala Initial import from Sourceforge.JP SVN
authored
41 }
42
43 while (<>) {
44 chomp;
45 s!/EntL[^/]+/!/!;
46 if (m!^([^ ]+) ([^ ]+) /(.*)/$!) {
47 ($kanji,$kana,$defn)=($1,$2,$3);
1c9e2b3 @mskala IDSgrep 0.2
authored
48 $kanji=~s/\(P\)$//;
cf60c28 @mskala Initial import from Sourceforge.JP SVN
authored
49 foreach $ksub (split(';',$kanji)) {
50 print "$ksub】,".join(',',
51 map {(defined $kvg{$_})?$kvg{$_}:$_;} split('',$ksub)).
52 "$kana $defn\n";
53 }
54 }
55 }
Something went wrong with that request. Please try again.