Chaoses-Ib / IbPinyinLib

一个高性能 Rust 拼音匹配库,支持 C、AHK2
MIT License
28 stars 0 forks source link

请问下,在autohotkey中使用时,能提取匹配到的具体文字吗? #4

Closed citemp closed 5 months ago

citemp commented 5 months ago

比如说"dianzi"能匹配到"电子邮件",如果想提取具体匹配到的"电子",在autohotkey中能做得到吗?

Chaoses-Ib commented 5 months ago

Rust 里是可以的,但是 AHK 没包装接口,今晚我加一下。

Chaoses-Ib commented 5 months ago

v0.2.5 已发布。

AHK2 用例:

text := "拼音搜索Everything"
IsMatch := IbPinyin_Match("pysousuoeve", text, IbPinyin_AsciiFirstLetter | IbPinyin_Ascii, &start, &end)
MsgBox(IsMatch ": " start ", " end ", " SubStr(text, start, end - start))

文本 := "拼音搜索Everything"
是否匹配 := 拼音_匹配("pysousuoeve", 文本, 拼音_简拼 | 拼音_全拼, &开始位置, &结束位置)
MsgBox(是否匹配 ": " 开始位置 ", " 结束位置 ", " SubStr(文本, 开始位置, 结束位置 - 开始位置))
citemp commented 5 months ago

以下范例代码可以正常运行: text := "拼音搜索Everything" IsMatch := IbPinyin_Match("pysousuoeve", text, IbPinyin_AsciiFirstLetter | IbPinyin_Ascii, &start, &end) MsgBox(IsMatch ": " start ", " end ", " SubStr(text, start, end - start))

但似乎哪里出了问题, 将上述代码中的"pysousuoeve"改成其他字符,比如"abc",甚至是"1234", IsMatch的结果都是true, msgbox的结果都是"1:4294967296,0,"。

上一个版本IbPinyinLib.AHK2.v0.2.4没有出现这个问题。

Chaoses-Ib commented 5 months ago

对 AHK 不太熟,返回值的判断出了点问题。v0.2.6 已修复。

citemp commented 5 months ago

经测试,已无问题,十分感谢!