faker-okinawa 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/CODE_OF_CONDUCT.md +49 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +66 -0
  7. data/Rakefile +2 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +8 -0
  10. data/faker-okinawa.gemspec +23 -0
  11. data/lib/faker/okinawa.rb +14 -0
  12. data/lib/faker/okinawa/address.rb +35 -0
  13. data/lib/faker/okinawa/awamori.rb +14 -0
  14. data/lib/faker/okinawa/base.rb +14 -0
  15. data/lib/faker/okinawa/fish.rb +14 -0
  16. data/lib/faker/okinawa/food.rb +14 -0
  17. data/lib/faker/okinawa/name.rb +14 -0
  18. data/lib/faker/okinawa/odic.rb +40 -0
  19. data/lib/faker/okinawa/school.rb +14 -0
  20. data/lib/faker/okinawa/version.rb +5 -0
  21. data/o-dic/address.dic +1068 -0
  22. data/o-dic/amami.dic +69 -0
  23. data/o-dic/awamori.dic +809 -0
  24. data/o-dic/base.dic +63 -0
  25. data/o-dic/bin-dic/ATOK.zip +0 -0
  26. data/o-dic/bin-dic/Kotoeri.dmg +0 -0
  27. data/o-dic/bin-dic/MSIME.zip +0 -0
  28. data/o-dic/bin-dic/MSIME2000.zip +0 -0
  29. data/o-dic/bin-dic/MSIME2002.zip +0 -0
  30. data/o-dic/bin-dic/MSIME2003.zip +0 -0
  31. data/o-dic/bin-dic/MSIME2007.zip +0 -0
  32. data/o-dic/bin-dic/VJEDelta40.zip +0 -0
  33. data/o-dic/bin-dic/anthydic20090901.tar.bz2 +0 -0
  34. data/o-dic/bin-dic/cannadic.tar.bz2 +0 -0
  35. data/o-dic/bin-dic/cannadic20030407.tar.bz2 +0 -0
  36. data/o-dic/bin-dic/cannadic20051104.tar.bz2 +0 -0
  37. data/o-dic/bin-dic/google-20111218.zip +0 -0
  38. data/o-dic/bus.dic +216 -0
  39. data/o-dic/city.dic +209 -0
  40. data/o-dic/doc/History.doc +138 -0
  41. data/o-dic/doc/README.1ST +79 -0
  42. data/o-dic/doc/format.txt +169 -0
  43. data/o-dic/food.dic +524 -0
  44. data/o-dic/geo.dic +815 -0
  45. data/o-dic/history.dic +1078 -0
  46. data/o-dic/island.dic +354 -0
  47. data/o-dic/misc.dic +1166 -0
  48. data/o-dic/name.dic +1039 -0
  49. data/o-dic/park.dic +535 -0
  50. data/o-dic/sakana.dic +160 -0
  51. data/o-dic/school.dic +1068 -0
  52. data/o-dic/script/ODIC.pm +98 -0
  53. data/o-dic/script/ccount.pl +111 -0
  54. data/o-dic/script/geta_checker.sh +29 -0
  55. data/o-dic/script/oki2atk.pl +192 -0
  56. data/o-dic/script/oki2canna.pl +131 -0
  57. data/o-dic/script/oki2cha.pl +154 -0
  58. data/o-dic/script/oki2jis.pl +167 -0
  59. data/o-dic/script/oki2kotoeri.pl +127 -0
  60. data/o-dic/script/oki2mozc.pl +156 -0
  61. data/o-dic/script/oki2msime.pl +136 -0
  62. data/o-dic/script/oki2osxjapaneseim.pl +168 -0
  63. data/o-dic/script/oki2vje.pl +138 -0
  64. data/o-dic/script/wcount.pl +114 -0
  65. metadata +135 -0
@@ -0,0 +1,156 @@
1
+ #!/usr/bin/perl
2
+ #
3
+ # 沖縄辞書のファイルをMozc/Google日本語入力のユーザー辞書へ変換するスクリプト
4
+ # 山城潤
5
+ #
6
+ # 使用例:
7
+ # $ cat ../*.dic | ./oki2mozc.pl | sort -u > mozc_okidic.txt
8
+ #
9
+ # --mozc-source / -m オプションにMozcのソースツリーが指定された場合には、
10
+ # 沖縄辞書からMozcの辞書に取り込まれている単語を除外する。ただし、
11
+ # 品詞のチェックは行っていない。
12
+ # $ cat ../*.dic | ./oki2mozc.pl -m /path/to/mozc-w.x.y.z | sort -u > mozc_okidic.txt
13
+ #
14
+ # 品詞一覧
15
+ # mozc-w.x.y.z/dictionary/user_dictionary_storage.proto
16
+ # mozc-w.x.y.z/dictionary/user_dictionary_util.cc
17
+ # mozc-w.x.y.z/data/rules/user_pos.def
18
+ # 他の日本語変換システムとの品詞マッピング
19
+ # mozc-w.x.y.z/data/rules/third_party_pos_map.def
20
+ # サンプル
21
+ # mozc-w.x.y.z/third_party/japanese_usage_dictionary/usage_dict.txt
22
+ #
23
+
24
+ use 5.10.1; # for "use feature 'switch'"
25
+ use FindBin;
26
+ use lib $FindBin::Bin; # For search scripts/ODIC.pm
27
+ require 'ODIC.pm';
28
+
29
+ use strict;
30
+ use feature 'switch';
31
+ use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat);
32
+
33
+ my $with_comment;
34
+ my $help_only;
35
+ my $mozc_source;
36
+
37
+ GetOptions(
38
+ 'with-comment|c' => \$with_comment,
39
+ 'help|h' => \$help_only,
40
+ 'mozc-source|m=s' => \$mozc_source
41
+ );
42
+ if (defined($help_only)) {
43
+ print STDERR "usage: $0 [--with-comment|-c] [--help|-h] [--mozc-source|-m path_to_mozc_source]\n";
44
+ exit 1;
45
+ }
46
+ if (defined($mozc_source) && (! -d $mozc_source)) {
47
+ print STDERR "`$mozc_source': Not a directory.\n";
48
+ exit 2;
49
+ }
50
+
51
+ while (<>) {
52
+ next if (/^\s*$|^\s*\#.*$/); # 空行・コメントのみの行を読み飛ばす
53
+
54
+ if (/^(\S+)\s+(\S+)\s+(\S+)\s+#\s*(.*)$/) {
55
+ my $phonate = $1; # 読み
56
+ my $word = $2; # 単語
57
+ my $class = $3; # 品詞
58
+ my $comment = ''; # コメント
59
+ if (defined($with_comment)) {
60
+ $comment = $4; # 必要な時にはコメントを付けられる
61
+ # 不要なデータをコメントから除外する
62
+ $comment =~ s/\s*@@@\s*//; # chasen 向け除外マーカー
63
+ $comment =~ s/〓あり\s*\([^\)]+\)\s*//; # JIS X 0208 範囲外マーカー
64
+ }
65
+
66
+ ODIC::check_phonate($phonate);
67
+ ODIC::check_word($word);
68
+ &print_dictionary($phonate, $word, $class, $comment);
69
+
70
+ } elsif (/^(\S+)\s+(\S+)\s+(\S+)/) {
71
+ my $phonate = $1; # 読み
72
+ my $word = $2; # 単語
73
+ my $class = $3; # 品詞
74
+ my $comment = ''; # コメント
75
+
76
+ ODIC::check_phonate($phonate);
77
+ ODIC::check_word($word);
78
+ &print_dictionary($phonate, $word, $class, $comment);
79
+
80
+ } else {
81
+ print STDERR "Error: $.: too few field number `$_'\n";
82
+ print "$_";
83
+ }
84
+ }
85
+
86
+ &version;
87
+ exit 0;
88
+
89
+
90
+ # mozc の辞書には沖縄辞書からデータが取り込まれているため、重複を避ける。
91
+ sub find_from_mozc_dictionary {
92
+ my $phonate = shift;
93
+ my $word = shift;
94
+ if (defined $mozc_source) {
95
+ my @dictionaries = glob "$mozc_source/data/dictionary_oss/dictionary*.txt";
96
+ system('egrep', '-q', "^$phonate\[[:space:]]{1}[[:digit:]]{4}[[:space:]]{1}[[:digit:]]{4}[[:space:]]{1}[[:digit:]]{4}[[:space:]]{1}$word\$", @dictionaries);
97
+
98
+ if ($? == 0) {
99
+ return 1; # found
100
+ }
101
+ }
102
+ return 0; # not found
103
+ }
104
+
105
+ sub print_dictionary {
106
+ my $phonate = shift;
107
+ my $word = shift;
108
+ my $class = shift;
109
+ my $comment = shift;
110
+
111
+ given ($class) {
112
+ when ('普通名詞') { $class = '名詞'; }
113
+ when ('サ変名詞') { $class = '名詞サ変'; }
114
+ when ('形動名詞') { $class = '名詞形動'; }
115
+ when ('その他の人名') { $class = '人名'; }
116
+ when ('単純地名') { $class = '地名'; }
117
+ when ('接尾語付き地名') { $class = '接尾地名'; }
118
+ when ('組織名') { $class = '組織'; }
119
+ when ('その他固有名詞') { $class = '固有名詞'; }
120
+ when ('形容動詞') { $class = '名詞形動'; }
121
+ when ('数字列接頭語') { $class = '接頭語'; }
122
+ when ('接尾語') { $class = '接尾一般'; }
123
+ when ('人名接尾語') { $class = '接尾人名'; }
124
+ when ('地名接尾語') { $class = '接尾地名'; }
125
+ when ('組織名接尾語') { $class = '接尾一般'; }
126
+ when ('数字列接尾語') { $class = '助数詞'; }
127
+ when ('成句') { $class = '名詞'; }
128
+ when ('無品詞') { $class = '独立語'; }
129
+ default {
130
+ # 姓、名、副詞、接続詞、感動詞、形容詞、接頭語
131
+ }
132
+ }
133
+
134
+ if (!find_from_mozc_dictionary($phonate, $word)) {
135
+ print "$phonate\t$word\t$class\t$comment\n";
136
+ }
137
+ }
138
+
139
+ sub version {
140
+ my $class = shift;
141
+
142
+ my $sec;
143
+ my $min;
144
+ my $hour;
145
+ my $mday;
146
+ my $mon;
147
+ my $year;
148
+
149
+ ($sec, $min, $hour, $mday, $mon, $year) = localtime(time());
150
+ $year += 1900;
151
+ $mon++;
152
+ # 「おきなわじしょのひづけ」と入力したときのみ候補に表示される。
153
+ # 「おきなわじしょのひづけとにゅうりょく」と入力したら候補には出てこない。
154
+ print "おきなわじしょのひづけ\t$year年$mon月$mday日(沖縄辞書の日付け)\t短縮よみ\t沖縄辞書生成時に作成される単語\n";
155
+ }
156
+
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/perl
2
+ #
3
+ # oki2msime.pl - 沖縄辞書のファイルをMS-IMEで取り込めるテキスト形式に変換するスクリプト
4
+ # GANAHA Makoto makoto@ganaha.org
5
+ # $Id: oki2msime.pl,v 1.5 2008/01/16 02:26:58 ga2 Exp $
6
+ # 使用例:
7
+ # 以下の様に「okinawa.txt」を作成し
8
+ # $ cat ../*.dic | ./oki2msime.pl -g | sort -u > okinawa.txt
9
+ # ユーザー辞書に取り込む場合
10
+ # 「Microsoft IME 辞書ツール 2000」を起動し「ツール(T)」->「テキスト ファイルからの登録(T)」から「okinawa.txt」を取り込んで下さい。
11
+ # システム辞書を作成する場合
12
+ # 「Microsoft IME 辞書ツール 2000」を起動し「ファイル(F)」->「新規作成(N)」よりダミーのユーザー辞書を作成します。
13
+ # 「ツール(T)」->「テキスト ファイルからの登録(T)」から「okinawa.txt」を取り込んで下さい。
14
+ # 「ツール(T)」->「システム辞書の作成(S)」からシステム辞書を作成します。
15
+ # ダミーのユーザー辞書はいりませんので削除してください。
16
+ #
17
+ # 「尚灝王」(しょうこうおう)など、JIS X 0208の範囲外の文字が含まれる単語を
18
+ # 辞書にインポートする場合には、UTF-8 で出力してから、Notepad.exeなどで
19
+ # 「Unicode」(UTF-16LE BOM付き)に変換してください。
20
+ #
21
+ use 5.10.1; # for "use feature 'switch'"
22
+ use FindBin;
23
+ use lib $FindBin::Bin; # For search scripts/ODIC.pm
24
+ require 'ODIC.pm';
25
+ use strict;
26
+ use feature 'switch';
27
+ use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat);
28
+
29
+ my $with_comment;
30
+ my $help_only;
31
+ my $skip_geta;
32
+ my $utf8_output;
33
+
34
+ GetOptions(
35
+ 'with-comment|c' => \$with_comment,
36
+ 'help|h' => \$help_only,
37
+ 'skip-geta|g' => \$skip_geta,
38
+ 'utf8|u' => \$utf8_output
39
+ );
40
+ if (defined($help_only)) {
41
+ print STDERR "usage: $0 [--with-comment|-c] [--help|-h] [--skip-geta|-g] [--utf8-output|-u]\n";
42
+ exit 1;
43
+ }
44
+
45
+ while (<>) {
46
+ next if (/^\s*$|^\s*\#.*$/); # 空行・コメントのみの行を読み飛ばす
47
+
48
+ # JIS X 0208 に含まれていない文字を含む行を読み飛ばす
49
+ # 読み飛ばしにはコメントに「〓あり」マーカーが必要
50
+ next if (defined($skip_geta) && /〓あり/);
51
+
52
+ if (/^(\S+)\s+(\S+)\s+(\S+)\s+#\s*(.*)$/) {
53
+ my $phonate = $1; # 読み
54
+ my $word = $2; # 単語
55
+ my $class = $3; # 品詞
56
+ my $comment = ''; # コメント
57
+ if (defined($with_comment)) {
58
+ $comment = $4; # 必要な時にはコメントを付けられる
59
+ # 不要なデータをコメントから除外する
60
+ $comment =~ s/\s*@@@\s*//; # chasen 向け除外マーカー
61
+ $comment =~ s/〓あり\s*\([^\)]+\)\s*//; # JIS X 0208 範囲外マーカー
62
+ }
63
+
64
+ ODIC::check_phonate($phonate);
65
+ ODIC::check_word($word);
66
+ &print_dictionary($phonate, $word, $class, $comment);
67
+
68
+ } elsif (/^(\S+)\s+(\S+)\s+(\S+)/) {
69
+ my $phonate = $1; # 読み
70
+ my $word = $2; # 単語
71
+ my $class = $3; # 品詞
72
+ my $comment = ''; # コメント
73
+
74
+ ODIC::check_phonate($phonate);
75
+ ODIC::check_word($word);
76
+ &print_dictionary($phonate, $word, $class, $comment);
77
+
78
+ } else {
79
+ print STDERR "Error: $.: too few field number `$_'\n";
80
+ print "$_";
81
+ }
82
+ }
83
+ &version;
84
+ exit 0;
85
+
86
+
87
+ sub print_dictionary {
88
+ my $phonate = shift;
89
+ my $word = shift;
90
+ my $class = shift;
91
+ my $comment = shift;
92
+
93
+ given ($class) {
94
+ when ('普通名詞') { $class = '名詞'; }
95
+ when ('サ変名詞') { $class = 'さ変名詞'; }
96
+ when ('その他の人名') { $class = '人名'; }
97
+ when ('単純地名') { $class = '地名その他'; }
98
+ when ('接尾語付き地名') { $class = '地名接尾語'; }
99
+ when ('組織名') { $class = '固有名詞'; }
100
+ when ('その他固有名詞') { $class = '固有名詞'; }
101
+ when ('数字列接頭語') { $class = '接頭語'; }
102
+ when ('人名接尾語') { $class = '姓名接尾語'; }
103
+ when ('組織名接尾語') { $class = '接尾語'; }
104
+ when ('数字列接尾語') { $class = '接尾語'; }
105
+ when ('成句') { $class = '名詞'; }
106
+ when ('無品詞') { $class = '名詞'; }
107
+ default {
108
+ # 形動名詞、姓、名、副詞、接続詞、感動詞、形容詞、
109
+ # 接頭語、接尾語、地名接尾語
110
+ }
111
+ }
112
+
113
+ if (defined($utf8_output)) {
114
+ print "$phonate\t$word\t$class\t$comment\r\n";
115
+ } else {
116
+ print ODIC::to_shiftjis("$phonate\t$word\t$class\t$comment\r\n");
117
+ }
118
+ }
119
+
120
+ sub version {
121
+ my $sec;
122
+ my $min;
123
+ my $hour;
124
+ my $mday;
125
+ my $mon;
126
+ my $year;
127
+
128
+ ($sec, $min, $hour, $mday, $mon, $year) = localtime(time());
129
+ $year += 1900;
130
+ $mon++;
131
+ if (defined($utf8_output)) {
132
+ print "おきなわじしょのひづけ\t$year/$mon/$mday(沖縄辞書の日付け)\t名詞\r\n";
133
+ } else {
134
+ print ODIC::to_shiftjis("おきなわじしょのひづけ\t$year/$mon/$mday(沖縄辞書の日付け)\t名詞\r\n");
135
+ }
136
+ }
@@ -0,0 +1,168 @@
1
+ #!/usr/bin/perl
2
+ #
3
+ # 沖縄辞書のファイルを Mac OS X 日本語入力メソッド(Yosemite 以降)の
4
+ # 「追加辞書」として変換するためのスクリプト
5
+ #
6
+ # $ cat *.dic | script/oki2osxjapaneseim.pl --utf8 | env LC_ALL=C sort --unique > okinawa.txt
7
+ # 読みは20文字以内、単語は32文字以内です。
8
+ # ことえりと違い、UTF8のCSVファイルとして変換します。
9
+ #
10
+ # システム環境設定の[キーボード] で日本語入力メソッドの
11
+ # [入力ソース]タブを選択し、追加辞書リストボックスに
12
+ # 変換したファイルをドロップする。
13
+
14
+ use FindBin;
15
+ use lib $FindBin::Bin; # For search scripts/ODIC.pm
16
+
17
+ require 5.6.0;
18
+ require 'ODIC.pm';
19
+ use strict;
20
+ use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat);
21
+
22
+ our $phonate;
23
+ our $word;
24
+ our $class;
25
+
26
+ my $help_only;
27
+ my $skip_geta;
28
+ my $utf8;
29
+
30
+ GetOptions(
31
+ 'help|h' => \$help_only,
32
+ 'skip-geta|g' => \$skip_geta,
33
+ 'utf8|u' => \$utf8
34
+ );
35
+
36
+ if (defined($help_only)) {
37
+ print STDERR "usage: $0 [--help|-h] [--utf8|-u [--skip-geta|-g]]\n";
38
+ exit 1;
39
+ }
40
+ while (<>) {
41
+ # JIS X 0208 に含まれていない文字を含む行を読み飛ばす
42
+ # 読み飛ばしにはコメントに「〓あり」マーカーが必要
43
+ next if ( (defined($skip_geta) || (not defined($utf8)) ) && /〓あり/);
44
+
45
+ s/#.*$//; # `#'以降を取り去る
46
+ next if (/^\s*$/); # その結果空行になった行は読み飛ばす。
47
+ if (/(\S+)\s+(\S+)\s+(\S+)/) {
48
+ $phonate = $1; # 読み
49
+ $word = $2; # 単語
50
+ $class = $3; # 品詞
51
+ # Yosemite では「Q's瑞穂」が「Qs瑞穂」になる。
52
+ $word =~ s/\'/\"\'/g; # ' → "' # 「Q's瑞穂」対応
53
+ ODIC::check_phonate($phonate);
54
+ if ($word !~ /\"\'/g) {
55
+ # check_word() では " をエラーにするので
56
+ # エスケープしたら避ける。
57
+ ODIC::check_word($word);
58
+ }
59
+ &convert_class;
60
+
61
+ } else {
62
+ print STDERR "Error: $.: too few field number `$_'\n";
63
+ print "$_";
64
+ }
65
+ }
66
+ &version;
67
+ exit 0;
68
+
69
+ # 品詞変換規則はこちらを参考にしました。
70
+ #
71
+ # 【Yosemite版】JapaneseIM(旧ことえり)を操る時に便利な覚え書き(Tips集)
72
+ # http://nadroom.dousetsu.com/kotoeri/kotoeri_yosemite.html
73
+ sub convert_class {
74
+ if ($class eq "普通名詞") { # OK
75
+ }
76
+ elsif ($class eq "サ変名詞") { # OK
77
+ }
78
+ elsif ($class eq "形動名詞") {
79
+ $class = '普通名詞';
80
+ }
81
+ elsif ($class eq "姓") {
82
+ $class = 'その他の固有名詞';
83
+ }
84
+ elsif ($class eq "名") {
85
+ $class = 'その他の固有名詞';
86
+ }
87
+ elsif ($class eq "その他の人名") {
88
+ $class = 'その他の固有名詞';
89
+ }
90
+ elsif ($class eq "単純地名") {
91
+ $class = '地名';
92
+ }
93
+ elsif ($class eq "接尾語付き地名") {
94
+ $class = '地名';
95
+ }
96
+ elsif ($class eq "組織名") {
97
+ $class = 'その他の固有名詞';
98
+ }
99
+ elsif ($class eq "その他固有名詞") {
100
+ $class = 'その他の固有名詞';
101
+ }
102
+ elsif ($class eq "副詞") {
103
+ }
104
+ elsif ($class eq "接続詞") {
105
+ $class = '無品詞';
106
+ }
107
+ elsif ($class eq "感動詞") {
108
+ $class = '無品詞';
109
+ }
110
+ elsif ($class eq "形容詞") { # OK
111
+ }
112
+ elsif ($class eq "形容動詞") {
113
+ $class = '無品詞';
114
+ }
115
+ elsif ($class eq "接頭語") {
116
+ $class = '普通名詞';
117
+ }
118
+ elsif ($class eq "数字列接頭語") {
119
+ $class = '無品詞';
120
+ }
121
+ elsif ($class eq "接尾語") {
122
+ $class = '普通名詞';
123
+ }
124
+ elsif ($class eq "人名接尾語") {
125
+ $class = '無品詞';
126
+ }
127
+ elsif ($class eq "地名接尾語") {
128
+ $class = '無品詞';
129
+ }
130
+ elsif ($class eq "組織名接尾語") {
131
+ $class = '無品詞';
132
+ }
133
+ elsif ($class eq "数字列接尾語") {
134
+ $class = '無品詞';
135
+ }
136
+ elsif ($class eq "成句") {
137
+ $class = '無品詞';
138
+ }
139
+ elsif ($class eq "無品詞") { # OK
140
+ }
141
+ else {
142
+ print STDERR "Error: $.: unknown class `$class': $phonate\t$word\n";
143
+ }
144
+ if (defined($utf8)) {
145
+ print "$phonate,$word,$class\r\n";
146
+ } else {
147
+ print ODIC::to_shiftjis("$phonate,$word,$class\r\n");
148
+ }
149
+ }
150
+
151
+
152
+ sub version {
153
+ my $sec;
154
+ my $min;
155
+ my $hour;
156
+ my $mday;
157
+ my $mon;
158
+ my $year;
159
+
160
+ ($sec, $min, $hour, $mday, $mon, $year) = localtime(time());
161
+ $year += 1900;
162
+ $mon++;
163
+ if (defined($utf8)) {
164
+ print "おきなわじしょのひづけ,$year年$mon月$mday日(沖縄辞書の日付け),無品詞\r\n";
165
+ } else {
166
+ print ODIC::to_shiftjis("おきなわじしょのひづけ,$year年$mon月$mday日(沖縄辞書の日付け),無品詞\r\n");
167
+ }
168
+ }