Crates.io | ib-pinyin |
lib.rs | ib-pinyin |
version | 0.2.5 |
source | src |
created_at | 2023-12-16 17:20:32.738569 |
updated_at | 2024-04-19 22:00:54.196584 |
description | 一个高性能拼音匹配库 |
homepage | https://github.com/Chaoses-Ib/IbPinyinLib |
repository | https://github.com/Chaoses-Ib/IbPinyinLib |
max_upload_size | |
id | 1071880 |
size | 704,364 |
一个高性能 Rust 拼音匹配库。
use ib_pinyin::{matcher::PinyinMatcher, pinyin::PinyinNotation};
let matcher = PinyinMatcher::builder("pysousuoeve")
.pinyin_notations(PinyinNotation::Ascii | PinyinNotation::AsciiFirstLetter)
.build();
assert!(matcher.is_match("拼音搜索Everything"));
#include <ib_pinyin/ib_pinyin.h>
#include <ib_pinyin/notation.h>
// UTF-8
bool is_match = ib_pinyin_is_match_u8c(u8"pysousuoeve", u8"拼音搜索Everything", PINYIN_NOTATION_ASCII_FIRST_LETTER | PINYIN_NOTATION_ASCII);
// UTF-16
bool is_match = ib_pinyin_is_match_u16c(u"pysousuoeve", u"拼音搜索Everything", PINYIN_NOTATION_ASCII_FIRST_LETTER | PINYIN_NOTATION_ASCII);
// UTF-32
bool is_match = ib_pinyin_is_match_u32c(U"pysousuoeve", U"拼音搜索Everything", PINYIN_NOTATION_ASCII_FIRST_LETTER | PINYIN_NOTATION_ASCII);
原实现(停止维护)
#Include <IbPinyin>
IsMatch := IbPinyin_Match("pysousuoeve", "拼音搜索Everything")
; 指定拼音编码
IsMatch := IbPinyin_Match("pysousuoeve", "拼音搜索Everything", IbPinyin_AsciiFirstLetter | IbPinyin_Ascii)
; 获取匹配范围
IsMatch := IbPinyin_Match("pysousuoeve", "拼音搜索Everything", IbPinyin_AsciiFirstLetter | IbPinyin_Ascii, &start, &end)
; 中文 API
是否匹配 := 拼音_匹配("pysousuoeve", "拼音搜索Everything")
; 指定拼音编码
是否匹配 := 拼音_匹配("pysousuoeve", "拼音搜索Everything", 拼音_简拼 | 拼音_全拼)
; 获取匹配范围
是否匹配 := 拼音_匹配("pysousuoeve", "拼音搜索Everything", 拼音_简拼 | 拼音_全拼, &开始位置, &结束位置)
语言 | 库 | 拼音 | 双拼 | 词典 | 匹配 | 其它 |
---|---|---|---|---|---|---|
Rust (C, AHK2) |
IbPinyinLib | ✔️ Unicode | ✔️ | ❌ | ✔️ | 性能优先;支持 Unicode 辅助平面汉字 |
Rust (Node.js) |
rust-pinyin | ✔️ Unicode | ❌ | ❌ | ❌ | |
Rust | rust-pinyin | 简拼 | ❌ | ❌ | ❌ | |
C# | ToolGood.Words.Pinyin | ✔️ | ❌ | ❌ | 单编码? | |
C# | TinyPinyin.Net | ✔️ | ❌ | ❌ | ❌ | |
C# | Romanization.NET | Unicode | ❌ | ❌ | 支持日文、韩文、俄文、希腊文 | |
Java | PinIn | ✔️ | ✔️ | ❌ | ✔️ | 支持注音输入法、模糊音 |
Java | TinyPinyin | ✔️ | ❌ | ✔️ | ❌ | |
Go | go-pinyin | ✔️ | ❌ | ✔️ | ❌ | |
Python | python-pinyin | ✔️ | ❌ | ✔️ | ❌ | |
TS | pinyin-pro | ✔️ | ❌ | ❌ | ✔️ | |
JS | pinyin-match | ✔️ | ❌ | ❌ | 单编码 | 匹配时忽略空白 |
JS | pinyin-engine | ✔️ | ❌ | ❌ | 单编码 | |
JS | pinyin | ✔️ | ❌ | ✔️ | ❌ | |
JS | pinyinjs | ✔️ Unicode | ❌ | ❌ | ❌ | |
Perl (Rust, Java, Python, Ruby, JS, PHP) |
Text::Unidecode | ✔️ | ❌ | ❌ | ❌ | 支持文字广泛 |
数据库:
文件搜索/启动器:
文件管理:
文本编辑: