OSDN Git Service

デフォルトではコメントを辞書に含めないように変更した。
authorYAMASHIRO, Jun <yamajun@ofug.net>
Sun, 11 May 2014 04:48:03 +0000 (13:48 +0900)
committerYAMASHIRO, Jun <yamajun@ofug.net>
Sun, 11 May 2014 04:48:03 +0000 (13:48 +0900)
コメントの中にはただの連番や機械処理のための記号"@@@"も含まれるため、
ユーザーの混乱を避けるために、デフォルトでは辞書ファイルに
コメントを含めないように変更した。

script/oki2mozc.pl

index 7a55c9b..452d5e2 100755 (executable)
@@ -4,12 +4,12 @@
 #                                                      山城潤
 #
 # 使用例:
-#    $ cat ../*.dic | ./oki2mozc.pl > mozc_okidic.txt
+#    $ cat ../*.dic | ./oki2mozc.pl | sort -u > mozc_okidic.txt
 #
 #    --mozc-source / -m オプションにMozcのソースツリーが指定された場合には、
 #    沖縄辞書からMozcの辞書に取り込まれている単語を除外する。ただし、
 #    品詞のチェックは行っていない。
-#    $ cat ../*.dic | ./oki2mozc.pl -m /path/to/mozc-w.x.y.z > mozc_okidic.txt
+#    $ cat ../*.dic | ./oki2mozc.pl -m /path/to/mozc-w.x.y.z | sort -u > mozc_okidic.txt
 #
 # 品詞一覧
 # mozc-w.x.y.z/dictionary/user_dictionary_storage.proto
@@ -27,15 +27,17 @@ use strict;
 use feature 'switch';
 use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat);
 
+my $with_comment;
 my $help_only;
 my $mozc_source;
 
 GetOptions(
+    'with-comment|c' => \$with_comment,
     'help|h' => \$help_only,
     'mozc-source|m=s' => \$mozc_source
 );
 if (defined($help_only)) {
-    print "usage: $0 [--help|-h] [--mozc-source|-m path_to_mozc_source]\n";
+    print STDERR "usage: $0 [--with-comment|-c] [--help|-h] [--mozc-source|-m path_to_mozc_source]\n";
     exit 1;
 }
 if (defined($mozc_source) && (! -d $mozc_source)) {
@@ -50,7 +52,10 @@ while (<>) {
        my $phonate = $1;       # 読み
        my $word    = $2;       # 単語
        my $class   = $3;       # 品詞
-       my $comment = $4;       # コメント
+       my $comment = '';       # コメント
+       if (defined($with_comment)) {
+           my $comment = $4;   # 必要な時にはコメントを付けられる
+       }
 
        ODIC::check_phonate($phonate);
        ODIC::check_word($word);