Kouhei Sutou
null+****@clear*****
Mon Apr 22 17:08:40 JST 2013
Kouhei Sutou 2013-04-22 17:08:40 +0900 (Mon, 22 Apr 2013) New Revision: 2e7de88b4c5a942917c5d175bc5d910e8fb7ed4b https://github.com/groonga/groonga-normalizer-mysql/commit/2e7de88b4c5a942917c5d175bc5d910e8fb7ed4b Message: Add a new normalizer Name: NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark [groonga-dev,01301] Suggested by Kouhei Tanabe. Thanks!!! Added files: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/halfwidth_katakana_small.expected test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/halfwidth_katakana_small.test test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_semi_voiced_sound_mark.expected test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_semi_voiced_sound_mark.test test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_small.expected test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_small.test test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_with_voiced_sound_mark.expected test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_with_voiced_sound_mark.test test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_small.expected test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_small.test test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_semi_voiced_sound_mark.expected test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_semi_voiced_sound_mark.test test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_voiced_sound_mark.expected test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_voiced_sound_mark.test Modified files: normalizers/mysql.c Modified: normalizers/mysql.c (+35 -0) =================================================================== --- normalizers/mysql.c 2013-04-22 17:07:23 +0900 (37ef8a2) +++ normalizers/mysql.c 2013-04-22 17:08:40 +0900 (de2f9f5) @@ -23,6 +23,7 @@ #include "mysql_general_ci_table.h" #include "mysql_unicode_ci_table.h" +#include "mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table.h" #ifdef __GNUC__ # define GNUC_UNUSED __attribute__((__unused__)) @@ -240,6 +241,31 @@ mysql_unicode_ci_next(GNUC_UNUSED grn_ctx *ctx, return NULL; } +static grn_obj * +mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_next( + GNUC_UNUSED grn_ctx *ctx, + GNUC_UNUSED int nargs, + grn_obj **args, + GNUC_UNUSED grn_user_data *user_data) +{ + grn_obj *string = args[0]; + grn_encoding encoding; + + encoding = grn_string_get_encoding(ctx, string); + if (encoding != GRN_ENC_UTF8) { + GRN_PLUGIN_ERROR(ctx, + GRN_FUNCTION_NOT_IMPLEMENTED, + "[normalizer]" + "[mysql-unicode-ci-except-kana-ci-kana-with-voiced-sound-mark] " + "UTF-8 encoding is only supported: %s", + grn_encoding_to_string(encoding)); + return NULL; + } + normalize(ctx, string, + unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_table); + return NULL; +} + grn_rc GRN_PLUGIN_INIT(grn_ctx *ctx) { @@ -253,6 +279,15 @@ GRN_PLUGIN_REGISTER(grn_ctx *ctx) NULL, mysql_general_ci_next, NULL); grn_normalizer_register(ctx, "NormalizerMySQLUnicodeCI", -1, NULL, mysql_unicode_ci_next, NULL); + grn_normalizer_register(ctx, + "NormalizerMySQLUnicodeCI" + "Except" + "KanaCI" + "KanaWithVoicedSoundMark", + -1, + NULL, + mysql_unicode_ci_except_kana_ci_kana_with_voiced_sound_mark_next, + NULL); return GRN_SUCCESS; } Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/halfwidth_katakana_small.expected (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/halfwidth_katakana_small.expected 2013-04-22 17:08:40 +0900 (282f752) @@ -0,0 +1,4 @@ +register normalizers/mysql +[[0,0.0,0.0],true] +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark "ァィゥェォッャュョ" +[[0,0.0,0.0],{"normalized":"ぁぃぅぇぉっゃゅょ","types":[]}] Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/halfwidth_katakana_small.test (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/halfwidth_katakana_small.test 2013-04-22 17:08:40 +0900 (59711b9) @@ -0,0 +1,4 @@ +register normalizers/mysql + +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark \ + "ァィゥェォッャュョ" Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_semi_voiced_sound_mark.expected (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_semi_voiced_sound_mark.expected 2013-04-22 17:08:40 +0900 (acf8012) @@ -0,0 +1,4 @@ +register normalizers/mysql +[[0,0.0,0.0],true] +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark "ぱぴぷぺぽ" +[[0,0.0,0.0],{"normalized":"ぱぴぷぺぽ","types":[]}] Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_semi_voiced_sound_mark.test (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_semi_voiced_sound_mark.test 2013-04-22 17:08:40 +0900 (a5ac81d) @@ -0,0 +1,4 @@ +register normalizers/mysql + +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark \ + "ぱぴぷぺぽ" Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_small.expected (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_small.expected 2013-04-22 17:08:40 +0900 (f7dcb41) @@ -0,0 +1,4 @@ +register normalizers/mysql +[[0,0.0,0.0],true] +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark "ぁぃぅぇぉっゃゅょゎ" +[[0,0.0,0.0],{"normalized":"ぁぃぅぇぉっゃゅょゎ","types":[]}] Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_small.test (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_small.test 2013-04-22 17:08:40 +0900 (8fb4163) @@ -0,0 +1,4 @@ +register normalizers/mysql + +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark \ + "ぁぃぅぇぉっゃゅょゎ" Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_with_voiced_sound_mark.expected (+16 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_with_voiced_sound_mark.expected 2013-04-22 17:08:40 +0900 (34be810) @@ -0,0 +1,16 @@ +register normalizers/mysql +[[0,0.0,0.0],true] +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark "がぎぐげござじずぜぞだぢづでどばびぶべぼ" +[ + [ + 0, + 0.0, + 0.0 + ], + { + "normalized": "がぎぐげござじずぜぞだぢづでどばびぶべぼ", + "types": [ + + ] + } +] Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_with_voiced_sound_mark.test (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/hiragana_with_voiced_sound_mark.test 2013-04-22 17:08:40 +0900 (761d844) @@ -0,0 +1,4 @@ +register normalizers/mysql + +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark \ + "がぎぐげござじずぜぞだぢづでどばびぶべぼ" Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_small.expected (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_small.expected 2013-04-22 17:08:40 +0900 (6182153) @@ -0,0 +1,4 @@ +register normalizers/mysql +[[0,0.0,0.0],true] +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark "ァィゥェォッャュョヮ" +[[0,0.0,0.0],{"normalized":"ぁぃぅぇぉっゃゅょゎ","types":[]}] Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_small.test (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_small.test 2013-04-22 17:08:40 +0900 (0e113d5) @@ -0,0 +1,4 @@ +register normalizers/mysql + +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark \ + "ァィゥェォッャュョヮ" Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_semi_voiced_sound_mark.expected (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_semi_voiced_sound_mark.expected 2013-04-22 17:08:40 +0900 (5fb95b3) @@ -0,0 +1,4 @@ +register normalizers/mysql +[[0,0.0,0.0],true] +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark "パピプペポ" +[[0,0.0,0.0],{"normalized":"ぱぴぷぺぽ","types":[]}] Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_semi_voiced_sound_mark.test (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_semi_voiced_sound_mark.test 2013-04-22 17:08:40 +0900 (e30c429) @@ -0,0 +1,4 @@ +register normalizers/mysql + +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark \ + "パピプペポ" Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_voiced_sound_mark.expected (+16 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_voiced_sound_mark.expected 2013-04-22 17:08:40 +0900 (948e8ee) @@ -0,0 +1,16 @@ +register normalizers/mysql +[[0,0.0,0.0],true] +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark "ガギグゲゴザジズゼゾダヂヅデドバビブベボ" +[ + [ + 0, + 0.0, + 0.0 + ], + { + "normalized": "がぎぐげござじずぜぞだぢづでどばびぶべぼ", + "types": [ + + ] + } +] Added: test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_voiced_sound_mark.test (+4 -0) 100644 =================================================================== --- /dev/null +++ test/suite/unicode_ci_except_kana_ci_kana_with_voiced_sound_mark/katakana_with_voiced_sound_mark.test 2013-04-22 17:08:40 +0900 (d643746) @@ -0,0 +1,4 @@ +register normalizers/mysql + +normalize NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark \ + "ガギグゲゴザジズゼゾダヂヅデドバビブベボ" -------------- next part -------------- HTML����������������������������...Download