Skip to content

morpheme_funcs

MeCab morpheme extraction and set-based text similarity

morpheme_funcs · MeCab morpheme extraction and set-based text similarity

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
100902morpheme_funcsmorpheme_funcs0.0.0FTSUnknownRust

PostgreSQL · 12, 13, 14, 15, 16, 17

Usage

Sources:

morpheme_funcs version 0.0.0 is a Rust/pgrx wrapper around MeCab for Japanese morphological tokenization. to_morpheme_array(text) returns a sorted set of unique morphemes, while calculate_similar_score(text,text) computes the Jaccard ratio of the two unique-token sets.

Example

CREATE EXTENSION morpheme_funcs;
SELECT to_morpheme_array('形態素解析機能');
SELECT calculate_similar_score('大ねじ小ねじ', 'ねじ');

Build and runtime require the native MeCab library plus an installed dictionary. Tokenization therefore depends on the exact dictionary and configuration and may vary between servers. The score ignores token order and frequency, so it is not a linguistic or semantic similarity measure. The implementation keeps a mutable process-local tagger and is still version 0.0.0; pin the full native environment and load-test it before exposing it to arbitrary text.

Table reader