/* This function initializes a plugin. This function fails if there is no dictionary that uses the context encoding of groonga. */ grn_rc GRN_PLUGIN_INIT(grn_ctx *ctx) { sole_mecab = NULL; sole_mecab_mutex = grn_plugin_mutex_open(ctx); if (!sole_mecab_mutex) { GRN_PLUGIN_ERROR(ctx, GRN_NO_MEMORY_AVAILABLE, "[tokenizer][mecab] grn_plugin_mutex_open() failed"); return ctx->rc; } check_mecab_dictionary_encoding(ctx); return ctx->rc; }
/* This function initializes a plugin. This function fails if there is no dictionary that uses the context encoding of groonga. */ grn_rc GRN_PLUGIN_INIT(grn_ctx *ctx) { { char env[GRN_ENV_BUFFER_SIZE]; grn_getenv("GRN_MECAB_CHUNKED_TOKENIZE_ENABLED", env, GRN_ENV_BUFFER_SIZE); grn_mecab_chunked_tokenize_enabled = (env[0] && strcmp(env, "yes") == 0); } { char env[GRN_ENV_BUFFER_SIZE]; grn_getenv("GRN_MECAB_CHUNK_SIZE_THRESHOLD", env, GRN_ENV_BUFFER_SIZE); if (env[0]) { int threshold = -1; const char *end; const char *rest; end = env + strlen(env); threshold = grn_atoi(env, end, &rest); if (end > env && end == rest) { grn_mecab_chunk_size_threshold = threshold; } } } sole_mecab = NULL; sole_mecab_mutex = grn_plugin_mutex_open(ctx); if (!sole_mecab_mutex) { GRN_PLUGIN_ERROR(ctx, GRN_NO_MEMORY_AVAILABLE, "[tokenizer][mecab] grn_plugin_mutex_open() failed"); return ctx->rc; } check_mecab_dictionary_encoding(ctx); return ctx->rc; }