faker-okinawa 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +66 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/faker-okinawa.gemspec +23 -0
- data/lib/faker/okinawa.rb +14 -0
- data/lib/faker/okinawa/address.rb +35 -0
- data/lib/faker/okinawa/awamori.rb +14 -0
- data/lib/faker/okinawa/base.rb +14 -0
- data/lib/faker/okinawa/fish.rb +14 -0
- data/lib/faker/okinawa/food.rb +14 -0
- data/lib/faker/okinawa/name.rb +14 -0
- data/lib/faker/okinawa/odic.rb +40 -0
- data/lib/faker/okinawa/school.rb +14 -0
- data/lib/faker/okinawa/version.rb +5 -0
- data/o-dic/address.dic +1068 -0
- data/o-dic/amami.dic +69 -0
- data/o-dic/awamori.dic +809 -0
- data/o-dic/base.dic +63 -0
- data/o-dic/bin-dic/ATOK.zip +0 -0
- data/o-dic/bin-dic/Kotoeri.dmg +0 -0
- data/o-dic/bin-dic/MSIME.zip +0 -0
- data/o-dic/bin-dic/MSIME2000.zip +0 -0
- data/o-dic/bin-dic/MSIME2002.zip +0 -0
- data/o-dic/bin-dic/MSIME2003.zip +0 -0
- data/o-dic/bin-dic/MSIME2007.zip +0 -0
- data/o-dic/bin-dic/VJEDelta40.zip +0 -0
- data/o-dic/bin-dic/anthydic20090901.tar.bz2 +0 -0
- data/o-dic/bin-dic/cannadic.tar.bz2 +0 -0
- data/o-dic/bin-dic/cannadic20030407.tar.bz2 +0 -0
- data/o-dic/bin-dic/cannadic20051104.tar.bz2 +0 -0
- data/o-dic/bin-dic/google-20111218.zip +0 -0
- data/o-dic/bus.dic +216 -0
- data/o-dic/city.dic +209 -0
- data/o-dic/doc/History.doc +138 -0
- data/o-dic/doc/README.1ST +79 -0
- data/o-dic/doc/format.txt +169 -0
- data/o-dic/food.dic +524 -0
- data/o-dic/geo.dic +815 -0
- data/o-dic/history.dic +1078 -0
- data/o-dic/island.dic +354 -0
- data/o-dic/misc.dic +1166 -0
- data/o-dic/name.dic +1039 -0
- data/o-dic/park.dic +535 -0
- data/o-dic/sakana.dic +160 -0
- data/o-dic/school.dic +1068 -0
- data/o-dic/script/ODIC.pm +98 -0
- data/o-dic/script/ccount.pl +111 -0
- data/o-dic/script/geta_checker.sh +29 -0
- data/o-dic/script/oki2atk.pl +192 -0
- data/o-dic/script/oki2canna.pl +131 -0
- data/o-dic/script/oki2cha.pl +154 -0
- data/o-dic/script/oki2jis.pl +167 -0
- data/o-dic/script/oki2kotoeri.pl +127 -0
- data/o-dic/script/oki2mozc.pl +156 -0
- data/o-dic/script/oki2msime.pl +136 -0
- data/o-dic/script/oki2osxjapaneseim.pl +168 -0
- data/o-dic/script/oki2vje.pl +138 -0
- data/o-dic/script/wcount.pl +114 -0
- metadata +135 -0
@@ -0,0 +1,98 @@
|
|
1
|
+
#
|
2
|
+
# 沖縄辞書フォーマット共通ライブラリー
|
3
|
+
#
|
4
|
+
|
5
|
+
package ODIC;
|
6
|
+
|
7
|
+
use strict;
|
8
|
+
use Encode;
|
9
|
+
|
10
|
+
our $MAX_PHONATE = 40;
|
11
|
+
our $MAX_WORD = 64;
|
12
|
+
|
13
|
+
sub check_phonate {
|
14
|
+
my $phonate = shift;
|
15
|
+
|
16
|
+
if (length(Encode::decode('utf-8', $phonate)) > $MAX_PHONATE) {
|
17
|
+
print STDERR "Warning: $.: too long phonate `$phonate'\n";
|
18
|
+
}
|
19
|
+
if ($phonate =~ /[^あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもらりるれろがぎぐげござじずぜぞだぢづでどばびぶべぼぁぃぅぇぉっょゃゅゎぱぴぷぺぽやゆよわをんヴー]/) {
|
20
|
+
print STDERR "Warning: $.: illegal character in `$phonate'\n";
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
sub check_word {
|
25
|
+
my $word = shift;
|
26
|
+
|
27
|
+
if (length(Encode::decode('utf-8', $word)) > $MAX_WORD) {
|
28
|
+
print STDERR "Warning: $.: too long word `$word'\n";
|
29
|
+
}
|
30
|
+
if ($word =~ /[ \t",#]/) {
|
31
|
+
print STDERR "Warning: $.: illegal character in `$word'\n";
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
sub to_eucjp {
|
36
|
+
my $utf8_string = Encode::decode('utf-8', shift);
|
37
|
+
return Encode::encode('euc-jp', $utf8_string);
|
38
|
+
}
|
39
|
+
|
40
|
+
sub to_shiftjis {
|
41
|
+
my $utf8_string = Encode::decode('utf-8', shift);
|
42
|
+
# 'cp932' は、「~」の変換でおかしくなるので使用しない。
|
43
|
+
return Encode::encode('shift_jis', $utf8_string);
|
44
|
+
}
|
45
|
+
|
46
|
+
sub to_utf16 {
|
47
|
+
my $utf8_string = Encode::decode('utf-8', shift);
|
48
|
+
return Encode::encode('utf-16', $utf8_string);
|
49
|
+
}
|
50
|
+
|
51
|
+
1;
|
52
|
+
__END__
|
53
|
+
|
54
|
+
=head1 NAME
|
55
|
+
|
56
|
+
ODIC - 沖縄辞書 <http://www.zukeran.org/o-dic/> フォーマット向けの共通関数
|
57
|
+
|
58
|
+
=head1 EXAMPLE
|
59
|
+
|
60
|
+
require 'ODIC.pm';
|
61
|
+
|
62
|
+
while (<>) {
|
63
|
+
next if (/^\s*$|^\s*\#.*$/); # 空行・コメントのみの行を読み飛ばす
|
64
|
+
|
65
|
+
if (/^(\S+)\s+(\S+)\s+(\S+)\s+#\s*([[:^cntrl:]]*).*$/) {
|
66
|
+
my $phonate = $1; # 読み
|
67
|
+
my $word = $2; # 単語
|
68
|
+
my $class = $3; # 品詞
|
69
|
+
my $comment = $4; # コメント
|
70
|
+
ODIC::check_phonate($phonate);
|
71
|
+
ODIC::check_word($word);
|
72
|
+
&convert_class;
|
73
|
+
|
74
|
+
} elsif (/^(\S+)\s+(\S+)\s+(\S+)/) {
|
75
|
+
my $phonate = $1; # 読み
|
76
|
+
my $word = $2; # 単語
|
77
|
+
my $class = $3; # 品詞
|
78
|
+
my $comment = ''; # コメント
|
79
|
+
ODIC::check_phonate($phonate);
|
80
|
+
ODIC::check_word($word);
|
81
|
+
&convert_class;
|
82
|
+
|
83
|
+
} else {
|
84
|
+
print STDERR "Error: $.: too few field number `$_'\n";
|
85
|
+
print "$_";
|
86
|
+
}
|
87
|
+
}
|
88
|
+
exit 0;
|
89
|
+
|
90
|
+
sub convert_class {
|
91
|
+
print "$phonate\t$word\t$class\t$comment\n";
|
92
|
+
}
|
93
|
+
|
94
|
+
=head1 LICENSE
|
95
|
+
|
96
|
+
Public domain.
|
97
|
+
|
98
|
+
=cut
|
@@ -0,0 +1,111 @@
|
|
1
|
+
#!/usr/bin/perl
|
2
|
+
#
|
3
|
+
# ccount.pl - 沖縄辞書の品詞属性を種類ごとに集計
|
4
|
+
#
|
5
|
+
# $Id: ccount.pl,v 1.5 2002/06/16 04:31:52 void Exp $
|
6
|
+
#
|
7
|
+
# $ cat ../*.dic | ./ccount.pl | sort | uniq -c
|
8
|
+
require 5.6.0;
|
9
|
+
require 'ODIC.pm';
|
10
|
+
use strict;
|
11
|
+
our $phonate;
|
12
|
+
our $word;
|
13
|
+
our $class;
|
14
|
+
|
15
|
+
while (<>) {
|
16
|
+
s/#.*$//; # `#'以降を取り去る
|
17
|
+
next if (/^\s*$/); # その結果空行になった行は読み飛ばす。
|
18
|
+
if (/(\S+)\s+(\S+)\s+(\S+)/) {
|
19
|
+
$phonate = $1; # 読み
|
20
|
+
$word = $2; # 単語
|
21
|
+
$class = $3; # 品詞
|
22
|
+
ODIC::check_phonate($phonate);
|
23
|
+
ODIC::check_word($word);
|
24
|
+
&check_class;
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
print STDERR "Error: $.: too few field number `$_'\n";
|
28
|
+
print "$_";
|
29
|
+
}
|
30
|
+
}
|
31
|
+
exit 0;
|
32
|
+
|
33
|
+
|
34
|
+
sub check_class {
|
35
|
+
if ($class eq "普通名詞") {
|
36
|
+
print "$class\n";
|
37
|
+
}
|
38
|
+
elsif ($class eq "サ変名詞") {
|
39
|
+
print "$class\n";
|
40
|
+
}
|
41
|
+
elsif ($class eq "形動名詞") {
|
42
|
+
print "$class\n";
|
43
|
+
}
|
44
|
+
elsif ($class eq "姓") {
|
45
|
+
print "$class\n";
|
46
|
+
}
|
47
|
+
elsif ($class eq "名") {
|
48
|
+
print "$class\n";
|
49
|
+
}
|
50
|
+
elsif ($class eq "その他の人名") {
|
51
|
+
print "$class\n";
|
52
|
+
}
|
53
|
+
elsif ($class eq "単純地名") {
|
54
|
+
print "$class\n";
|
55
|
+
}
|
56
|
+
elsif ($class eq "接尾語付き地名") {
|
57
|
+
print "$class\n";
|
58
|
+
}
|
59
|
+
elsif ($class eq "組織名") {
|
60
|
+
print "$class\n";
|
61
|
+
}
|
62
|
+
elsif ($class eq "その他固有名詞") {
|
63
|
+
print "$class\n";
|
64
|
+
}
|
65
|
+
elsif ($class eq "副詞") {
|
66
|
+
print "$class\n";
|
67
|
+
}
|
68
|
+
elsif ($class eq "接続詞") {
|
69
|
+
print "$class\n";
|
70
|
+
}
|
71
|
+
elsif ($class eq "感動詞") {
|
72
|
+
print "$class\n";
|
73
|
+
}
|
74
|
+
elsif ($class eq "形容詞") {
|
75
|
+
print "$class\n";
|
76
|
+
}
|
77
|
+
elsif ($class eq "形容動詞") {
|
78
|
+
print "$class\n";
|
79
|
+
}
|
80
|
+
elsif ($class eq "接頭語") {
|
81
|
+
print "$class\n";
|
82
|
+
}
|
83
|
+
elsif ($class eq "数字列接頭語") {
|
84
|
+
print "$class\n";
|
85
|
+
}
|
86
|
+
elsif ($class eq "接尾語") {
|
87
|
+
print "$class\n";
|
88
|
+
}
|
89
|
+
elsif ($class eq "人名接尾語") {
|
90
|
+
print "$class\n";
|
91
|
+
}
|
92
|
+
elsif ($class eq "地名接尾語") {
|
93
|
+
print "$class\n";
|
94
|
+
}
|
95
|
+
elsif ($class eq "組織名接尾語") {
|
96
|
+
print "$class\n";
|
97
|
+
}
|
98
|
+
elsif ($class eq "数字列接尾語") {
|
99
|
+
print "$class\n";
|
100
|
+
}
|
101
|
+
elsif ($class eq "成句") {
|
102
|
+
print "$class\n";
|
103
|
+
}
|
104
|
+
elsif ($class eq "無品詞") {
|
105
|
+
print "$class\n";
|
106
|
+
}
|
107
|
+
else {
|
108
|
+
print STDERR "Error: $.: unknown class `$class': $phonate\t$word\n";
|
109
|
+
print "$class\n";
|
110
|
+
}
|
111
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# 辞書ファイル内の JIS X 0208 に含まれていない文字を検出するためのスクリプト
|
4
|
+
# 山城 潤
|
5
|
+
# $ ./geta_checker.sh
|
6
|
+
# ...UTF-8で差分を出力...
|
7
|
+
#
|
8
|
+
# このスクリプトの実行にはnkf(1)が必要です。
|
9
|
+
# https://sourceforge.jp/projects/nkf/
|
10
|
+
|
11
|
+
script_dir=`dirname $0`
|
12
|
+
for i in $script_dir/../*.dic
|
13
|
+
do
|
14
|
+
to_file=`mktemp /tmp/geta.XXXXXXX`
|
15
|
+
utf8_file=`mktemp /tmp/geta.XXXXXXX`
|
16
|
+
|
17
|
+
# UTF-8 -> Shift_JIS -> UTF-8_2
|
18
|
+
nkf -s "$i" > "$to_file"
|
19
|
+
nkf -u "$to_file" > "$utf8_file"
|
20
|
+
|
21
|
+
# UTF-8 と UTF-8_2 の差分を取って〓の位置を確認する。
|
22
|
+
if ! diff -u "$i" "$utf8_file"; then
|
23
|
+
echo "$i: Geta exists." 1>&2
|
24
|
+
fi
|
25
|
+
|
26
|
+
rm "$to_file"
|
27
|
+
rm "$utf8_file"
|
28
|
+
done
|
29
|
+
|
@@ -0,0 +1,192 @@
|
|
1
|
+
#!/usr/bin/perl
|
2
|
+
#
|
3
|
+
# oki2atk.pl - 沖縄辞書のファイルをATOK13形式に変換する。
|
4
|
+
#
|
5
|
+
# yonesu@syon.co.jp
|
6
|
+
#
|
7
|
+
# このスクリプトを使って、以下のように「okinawa.txt」を生成しておいて、
|
8
|
+
# $ cat *.dic | script/oki2atk.pl --utf8 | env LC_ALL=C sort --unique > okinawa.txt
|
9
|
+
# ATOK13の辞書ユーティリティを起動し、
|
10
|
+
# 「一括処理」-「単語一括処理」の「単語ファイル(T)」に
|
11
|
+
# okinawa.txtを指定し、「登録」を押下してください。
|
12
|
+
#
|
13
|
+
# 「尚灝王」(しょうこうおう)など、JIS X 0208の範囲外の文字が含まれる単語を
|
14
|
+
# 辞書にインポートする場合には、UTF-8 で出力してから、Notepad.exeなどで
|
15
|
+
# 「Unicode」(UTF-16LE BOM付き)に変換してください。
|
16
|
+
#
|
17
|
+
#############################################################################
|
18
|
+
# ATOK13での品詞体系 #
|
19
|
+
#1 名詞 2 固有人姓 3 固有人名 4 固有人他 5 固有地名 #
|
20
|
+
#6 固有組織 7 固有商品 8 固有一般 9 名詞サ変 10 名詞ザ変 #
|
21
|
+
#11 名詞形動 12 名サ形動 13 数詞 14 副詞 15 連体詞 #
|
22
|
+
#16 接続詞 17 感動詞 18 独立語 19 接頭語 20 冠数詞 #
|
23
|
+
#21 接尾語 22 助数詞 23 カ行五段 24 ガ行五段 25 サ行五段 #
|
24
|
+
#26 タ行五段 27 ナ行五段 28 バ行五段 29 マ行五段 30 ラ行五段 #
|
25
|
+
#31 ワ行五段 32 ハ行四段 33 一段動詞 34 カ変動詞 35 サ変動詞 #
|
26
|
+
#36 ザ変動詞 37 形容詞 38 形容詞ウ 39 形容動詞 40 形動タリ #
|
27
|
+
#41 単漢字 #
|
28
|
+
#############################################################################
|
29
|
+
|
30
|
+
require 5.6.0;
|
31
|
+
use FindBin;
|
32
|
+
use lib $FindBin::Bin; # For search scripts/ODIC.pm
|
33
|
+
require 'ODIC.pm';
|
34
|
+
use strict;
|
35
|
+
use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat);
|
36
|
+
|
37
|
+
our $phonate;
|
38
|
+
our $word;
|
39
|
+
our $class;
|
40
|
+
|
41
|
+
my $help_only;
|
42
|
+
my $skip_geta;
|
43
|
+
my $utf8_output;
|
44
|
+
|
45
|
+
GetOptions(
|
46
|
+
'help|h' => \$help_only,
|
47
|
+
'skip-geta|g' => \$skip_geta,
|
48
|
+
'utf8|u' => \$utf8_output
|
49
|
+
);
|
50
|
+
if (defined($help_only)) {
|
51
|
+
print STDERR "usage: $0 [--help|-h] [--skip-geta|-g] [--utf8-output|-u]\n";
|
52
|
+
exit 1;
|
53
|
+
}
|
54
|
+
|
55
|
+
&header;
|
56
|
+
|
57
|
+
while (<>) {
|
58
|
+
# JIS X 0208 に含まれていない文字を含む行を読み飛ばす
|
59
|
+
# 読み飛ばしにはコメントに「〓あり」マーカーが必要
|
60
|
+
next if (defined($skip_geta) && /〓あり/);
|
61
|
+
|
62
|
+
s/#.*$//; # `#'以降を取り去る
|
63
|
+
next if (/^\s*$/); # その結果空行になった行は読み飛ばす。
|
64
|
+
|
65
|
+
if (/(\S+)\s+(\S+)\s+(\S+)/) {
|
66
|
+
$phonate = $1; # 読み
|
67
|
+
$word = $2; # 単語
|
68
|
+
$class = $3; # 品詞
|
69
|
+
ODIC::check_phonate($phonate);
|
70
|
+
ODIC::check_word($word);
|
71
|
+
&convert_class;
|
72
|
+
}
|
73
|
+
else {
|
74
|
+
print STDERR "Error: $.: too few field number `$_'\n";
|
75
|
+
print "$_";
|
76
|
+
}
|
77
|
+
}
|
78
|
+
&version;
|
79
|
+
exit 0;
|
80
|
+
|
81
|
+
|
82
|
+
sub convert_class {
|
83
|
+
if ($class eq "普通名詞") {
|
84
|
+
$class = 1;
|
85
|
+
}
|
86
|
+
elsif ($class eq "サ変名詞") {
|
87
|
+
$class = 9;
|
88
|
+
}
|
89
|
+
elsif ($class eq "形動名詞") {
|
90
|
+
$class = 11;
|
91
|
+
}
|
92
|
+
elsif ($class eq "姓") {
|
93
|
+
$class = 2;
|
94
|
+
}
|
95
|
+
elsif ($class eq "名") {
|
96
|
+
$class = 3;
|
97
|
+
}
|
98
|
+
elsif ($class eq "その他の人名") {
|
99
|
+
$class = 4;
|
100
|
+
}
|
101
|
+
elsif ($class eq "単純地名") {
|
102
|
+
$class = 5;
|
103
|
+
}
|
104
|
+
elsif ($class eq "接尾語付き地名") {
|
105
|
+
$class = 5;
|
106
|
+
}
|
107
|
+
elsif ($class eq "組織名") {
|
108
|
+
$class = 6;
|
109
|
+
}
|
110
|
+
elsif ($class eq "その他固有名詞") {
|
111
|
+
$class = 7;
|
112
|
+
}
|
113
|
+
elsif ($class eq "副詞") {
|
114
|
+
$class = 14;
|
115
|
+
}
|
116
|
+
elsif ($class eq "接続詞") {
|
117
|
+
$class = 16;
|
118
|
+
}
|
119
|
+
elsif ($class eq "感動詞") {
|
120
|
+
$class = 17;
|
121
|
+
}
|
122
|
+
elsif ($class eq "形容詞") {
|
123
|
+
$class = 37;
|
124
|
+
}
|
125
|
+
elsif ($class eq "形容動詞") {
|
126
|
+
$class = 39;
|
127
|
+
}
|
128
|
+
elsif ($class eq "接頭語") {
|
129
|
+
$class = 19;
|
130
|
+
}
|
131
|
+
elsif ($class eq "数字列接頭語") {
|
132
|
+
$class = 20;
|
133
|
+
}
|
134
|
+
elsif ($class eq "接尾語") {
|
135
|
+
$class = 21;
|
136
|
+
}
|
137
|
+
elsif ($class eq "人名接尾語") {
|
138
|
+
$class = 21;
|
139
|
+
}
|
140
|
+
elsif ($class eq "地名接尾語") {
|
141
|
+
$class = 21;
|
142
|
+
}
|
143
|
+
elsif ($class eq "組織名接尾語") {
|
144
|
+
$class = 21;
|
145
|
+
}
|
146
|
+
elsif ($class eq "数字列接尾語") {
|
147
|
+
$class = 13;
|
148
|
+
}
|
149
|
+
elsif ($class eq "成句") {
|
150
|
+
$class = 1;
|
151
|
+
}
|
152
|
+
elsif ($class eq "無品詞") {
|
153
|
+
$class = 41;
|
154
|
+
}
|
155
|
+
else {
|
156
|
+
print STDERR "Error: $.: unknown class `$class': $phonate\t$word\n";
|
157
|
+
if (defined($utf8_output)) {
|
158
|
+
print "$phonate\t$word\t[〓]\r\n";
|
159
|
+
} else {
|
160
|
+
print ODIC::to_shiftjis("$phonate\t$word\t[〓]\r\n");
|
161
|
+
}
|
162
|
+
return;
|
163
|
+
}
|
164
|
+
if (defined($utf8_output)) {
|
165
|
+
print "$phonate\t$word\t $class \r\n";
|
166
|
+
} else {
|
167
|
+
print ODIC::to_shiftjis("$phonate\t$word\t $class \r\n");
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
sub version {
|
172
|
+
my $sec;
|
173
|
+
my $min;
|
174
|
+
my $hour;
|
175
|
+
my $mday;
|
176
|
+
my $mon;
|
177
|
+
my $year;
|
178
|
+
|
179
|
+
($sec, $min, $hour, $mday, $mon, $year) = localtime(time());
|
180
|
+
$year += 1900;
|
181
|
+
$mon++;
|
182
|
+
if (defined($utf8_output)) {
|
183
|
+
print "おきなわじしょのひづけ\t$year/$mon/$mday(沖縄辞書の日付け)\t 1 \r\n";
|
184
|
+
} else {
|
185
|
+
print ODIC::to_shiftjis("おきなわじしょのひづけ\t$year/$mon/$mday(沖縄辞書の日付け)\t 1 \r\n");
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
sub header {
|
190
|
+
print "!!DICUT16\r\n";
|
191
|
+
}
|
192
|
+
|
@@ -0,0 +1,131 @@
|
|
1
|
+
#!/usr/bin/perl
|
2
|
+
#
|
3
|
+
# oki2canna.pl - 沖縄辞書のファイルをCanna/Anthyに持って行くためのスクリプト
|
4
|
+
# 瑞慶覧辰
|
5
|
+
#
|
6
|
+
# 使用例:
|
7
|
+
# Canna向け
|
8
|
+
# $ cat ../*.dic | ./oki2canna.pl -g | nkf -e | sort -u > okinawa.txt
|
9
|
+
# $ mkbindic okinawa.txt
|
10
|
+
#
|
11
|
+
# Anthyユーザー辞書向け
|
12
|
+
# $ cat ../*.dic | ./oki2canna.pl |
|
13
|
+
# env LANG=C sort -u > ~/.anthy/imported_words_default.d/okinawa.t
|
14
|
+
#
|
15
|
+
# 品詞一覧
|
16
|
+
# anthy-9100h/src-worddic/wtab.h
|
17
|
+
#
|
18
|
+
# Canna37p3/cmd/wtoc/wtoc.c
|
19
|
+
# Canna37p3/dic/ideo/grammar/main.code
|
20
|
+
# Canna37p3/doc/man/guide/tex/hinshi.tex
|
21
|
+
|
22
|
+
use 5.10.1; # for "use feature 'switch'"
|
23
|
+
use FindBin;
|
24
|
+
use lib $FindBin::Bin; # For search scripts/ODIC.pm
|
25
|
+
require 'ODIC.pm';
|
26
|
+
use strict;
|
27
|
+
use feature 'switch';
|
28
|
+
use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat);
|
29
|
+
|
30
|
+
my $help_only;
|
31
|
+
my $skip_geta;
|
32
|
+
|
33
|
+
GetOptions(
|
34
|
+
'help|h' => \$help_only,
|
35
|
+
'skip-geta|g' => \$skip_geta
|
36
|
+
);
|
37
|
+
if (defined($help_only)) {
|
38
|
+
print STDERR "usage: $0 [--help|-h] [--skip-geta|-g]\n";
|
39
|
+
exit 1;
|
40
|
+
}
|
41
|
+
|
42
|
+
while (<>) {
|
43
|
+
next if (/^\s*$|^\s*\#.*$/); # 空行・コメントのみの行を読み飛ばす
|
44
|
+
|
45
|
+
# JIS X 0208 に含まれていない文字を含む行を読み飛ばす
|
46
|
+
# 読み飛ばしにはコメントに「〓あり」マーカーが必要
|
47
|
+
next if (defined($skip_geta) && /〓あり/);
|
48
|
+
|
49
|
+
if (/^(\S+)\s+(\S+)\s+(\S+)\s+#\s*([[:^cntrl:]]*).*$/) {
|
50
|
+
my $phonate = $1; # 読み
|
51
|
+
my $word = $2; # 単語
|
52
|
+
my $class = $3; # 品詞
|
53
|
+
|
54
|
+
ODIC::check_phonate($phonate);
|
55
|
+
ODIC::check_word($word);
|
56
|
+
&print_dictionary($phonate, $word, $class);
|
57
|
+
|
58
|
+
} elsif (/^(\S+)\s+(\S+)\s+(\S+)/) {
|
59
|
+
my $phonate = $1; # 読み
|
60
|
+
my $word = $2; # 単語
|
61
|
+
my $class = $3; # 品詞
|
62
|
+
|
63
|
+
ODIC::check_phonate($phonate);
|
64
|
+
ODIC::check_word($word);
|
65
|
+
&print_dictionary($phonate, $word, $class);
|
66
|
+
|
67
|
+
} else {
|
68
|
+
print STDERR "Error: $.: too few field number `$_'\n";
|
69
|
+
print "$_";
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
&version;
|
74
|
+
exit 0;
|
75
|
+
|
76
|
+
|
77
|
+
sub print_dictionary {
|
78
|
+
my $phonate = shift;
|
79
|
+
my $word = shift;
|
80
|
+
my $class = shift;
|
81
|
+
|
82
|
+
given ($class) {
|
83
|
+
when ('普通名詞') { $class = '#T35'; }
|
84
|
+
when ('サ変名詞') { $class = '#T30'; }
|
85
|
+
when ('形動名詞') { $class = '#T05'; }
|
86
|
+
when ('姓') { $class = '#JNS'; }
|
87
|
+
when ('名') { $class = '#JNM'; }
|
88
|
+
when ('その他の人名') { $class = '#JN'; }
|
89
|
+
when ('単純地名') { $class = '#CN'; }
|
90
|
+
when ('接尾語付き地名') { $class = '#CNS'; }
|
91
|
+
when ('組織名') { $class = '#KK'; }
|
92
|
+
when ('その他固有名詞') { $class = '#KK'; }
|
93
|
+
when ('副詞') { $class = '#F04'; }
|
94
|
+
when ('接続詞') { $class = '#CJ'; }
|
95
|
+
when ('感動詞') { $class = '#CJ'; }
|
96
|
+
when ('形容詞') { $class = '#KY'; }
|
97
|
+
when ('形容動詞') { $class = '#T05'; }
|
98
|
+
when ('接頭語') { $class = '#PRE'; }
|
99
|
+
when ('数字列接頭語') { $class = '#JS'; }
|
100
|
+
when ('接尾語') { $class = '#SUC'; }
|
101
|
+
when ('人名接尾語') { $class = '#JNSUC'; }
|
102
|
+
when ('地名接尾語') { $class = '#CNSUC1'; }
|
103
|
+
when ('組織名接尾語') { $class = '#SUC'; }
|
104
|
+
when ('数字列接尾語') { $class = '#SUC'; }
|
105
|
+
when ('成句') { $class = '#KJ'; }
|
106
|
+
when ('無品詞') { $class = '#KJ'; }
|
107
|
+
default {
|
108
|
+
print STDERR "Error: $.: unknown class `$class': $phonate\t$word\n";
|
109
|
+
print "$phonate 〓 $word\n";
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
print "$phonate $class $word\n";
|
114
|
+
}
|
115
|
+
|
116
|
+
sub version {
|
117
|
+
my $class = shift;
|
118
|
+
|
119
|
+
my $sec;
|
120
|
+
my $min;
|
121
|
+
my $hour;
|
122
|
+
my $mday;
|
123
|
+
my $mon;
|
124
|
+
my $year;
|
125
|
+
|
126
|
+
($sec, $min, $hour, $mday, $mon, $year) = localtime(time());
|
127
|
+
$year += 1900;
|
128
|
+
$mon++;
|
129
|
+
print "おきなわじしょのひづけ #T35 $year/$mon/$mday(沖縄辞書の日付け)\n";
|
130
|
+
}
|
131
|
+
|