Add chinese_convert option to the chinese_compatible tokenizer
What feature are you requesting?
Add a chinese_convert option to the chinese_compatible tokenizer, matching the option
already supported by pdb.jieba (added in #3764). Setting e.g.
pdb.chinese_compatible('chinese_convert=t2s') should convert Traditional Chinese to Simplified
(or the other supported modes: s2t, tw2s, tw2sp, s2tw, s2twp) before tokenization, the
same way pdb.jieba('chinese_convert=t2s') already does.
Why are you requesting this feature?
This was explicitly discussed and promised on the original Jieba PR (#3764) but never delivered
for the other Chinese-capable tokenizers. Reviewer feedback on that PR: "i think other
tokenizers which supports chinese could leverage this as well, like icu" -- to which the author
replied "I will add this property (chinese convert) to other tokenizers (like ICU) separately
later." That follow-up never happened. chinese_compatible is the simplest sibling to extend
first (no interacting options like Jieba's search_mode), and the underlying
ChineseConvertTokenizer<T: Tokenizer> wrapper used by Jieba is already fully generic over any
Tokenizer, so it's directly reusable here with no changes of its own.
What is your proposed implementation for this feature?
Mirror Jieba's existing implementation: extend SearchTokenizer::ChineseCompatible with a
chinese_convert: Option<ConvertMode> field, wire it through JSON parsing
(from_json_value), the typmod-string parsing paths (both apply_expression_params and
apply_typmod, adding a dedicated ChineseCompatibleTypmod mirroring JiebaTypmod), and
to_tantivy_tokenizer() (wrap the base ChineseTokenizer in ChineseConvertTokenizer when
configured, exactly as Jieba does). I've already implemented and tested this -- happy to open a
PR immediately if the direction is welcome.
Full Name:
Vijay Wankhede
Affiliation:
FetchAI
Source: paradedb/paradedb