1 Star 0 Fork 0

老k / ToolGood.Words.Pinyin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

ToolGood.Words.Pinyin

一款高性能拼音字母转化类,是ToolGood.Words拼音分支,追求极致加载速度。

ToolGood.Words.Pinyin支持范围 [0x3400,0x4DB5] [0x4E00,0x9FA5]

ToolGood.Words.FirstPinyin支持范围 [0x3400,0x4DB5] [0x4E00,0x9FA5]

ToolGood.Words.PinyinToolGood.Words.FirstPinyin两库内藏着8万组词组,精确度比同一类型拼音转化类库高。

为什么要分成2个项目

ToolGood.Words.Pinyin支持全拼和首字母,相比ToolGood.Words功能更小,第一次加载速度在70ms左右,而ToolGood.Words第一次加载需要800ms左右。

ToolGood.Words.FirstPinyin 只支持首字母,功能更小,体积更小,第一次加载速度更快(50ms),占用内存更小(28M)

ToolGood.Words.Pinyin 拼音模块

    // 获取全拼
    WordsHelper.GetPinyin("我爱中国");//WoAiZhongGuo   
    WordsHelper.GetPinyin("我爱中国",",");//Wo,Ai,Zhong,Guo   
    WordsHelper.GetPinyin("我爱中国",true);//WǒÀiZhōngGuó

    // 获取首字母
    WordsHelper.GetFirstPinyin("我爱中国");//WAZG
    // 获取全部拼音
    WordsHelper.GetAllPinyin('传');//Chuan,Zhuan
    // 获取姓名
    WordsHelper.GetPinyinForName("单一一");//ShanYiYi
    WordsHelper.GetPinyinForName("单一一",",");//Shan,Yi,Yi
    WordsHelper.GetPinyinForName("单一一",true);//ShànYīYī
    // 清理拼音缓存
    WordsHelper.ClearCache();

ToolGood.Words.Pinyin 拼音匹配

PinyinMatch:方法有SetKeywordsSetIndexsFindFindIndex

PinyinMatch<T>:方法有SetKeywordsFuncSetPinyinFuncSetPinyinSplitCharFind

    string s = "北京|天津|河北|辽宁|吉林|黑龙江|山东|江苏|上海|浙江|安徽|福建|江西|广东|广西|海南|河南|湖南|湖北|山西|内蒙古|宁夏|青海|陕西|甘肃|新疆|四川|贵州|云南|重庆|西藏|香港|澳门|台湾";

    PinyinMatch match = new PinyinMatch();
    match.SetKeywords(s.Split('|').ToList());

    var all = match.Find("BJ");
    Assert.AreEqual("北京", all[0]);
    Assert.AreEqual(1, all.Count);

    all = match.Find("北J");
    Assert.AreEqual("北京", all[0]);
    Assert.AreEqual(1, all.Count);

    all = match.Find("北Ji");
    Assert.AreEqual("北京", all[0]);
    Assert.AreEqual(1, all.Count);

    all = match.Find("S");
    Assert.AreEqual("山东", all[0]);
    Assert.AreEqual("江苏", all[1]);

    var all2 = match.FindIndex("BJ");
    Assert.AreEqual(0, all2[0]);
    Assert.AreEqual(1, all.Count);

ToolGood.Words.FirstPinyin 拼音

    WordsHelper.GetFirstPinyin("我爱中国");//WAZG
    WordsHelper.GetFirstPinyin("我爱中国", ",");//W,A,Z,G

    WordsHelper.GetAllFirstPinyin('传');// "C" "Z"

    WordsHelper.GetFirstPinyinForName("单一一");//SYY
    WordsHelper.GetFirstPinyinForName("单一一", ",");//S,Y,Y

    // 清理拼音缓存
    WordsHelper.ClearCache();

广告一下

《ToolGood 内容审核系统》正式发布,Windows、Linux双平台,内存占用小于100M。

官网:https://toolgood.com/

内存少了,功能却不少,可以下文字去官网测试。拼接后的脏字有26303904组(约2630W)。

c C ⒞ c ⓒ C C ℂ Ⓒ с С 𝐜 𝑐 𝚌 𝒸 𝒄 𝓬 𝕔 𝖼 𝗰 𝘤 𝙘 𝐂 𝐶 𝙲 𝒞 𝑪 𝓒 𝖢 𝗖 𝘊 𝘾 ©
a A ⒜ ā á ǎ à a ⓐ A A Ⓐ а А 𝐚 𝑎 𝚊 𝒶 𝒂 𝓪 𝕒 𝖺 𝗮 𝘢 𝙖 𝐀 𝐴 𝙰 𝒜 𝑨 𝓐 𝔸 𝖠 𝗔 𝘈 𝘼 Α α
o O ⒪ ō ó ǒ ò o ⓞ O O Ⓞ о О 𝐨 𝑜 𝚘 𝒐 𝓸 𝕠 𝗈 𝗼 𝘰 𝙤 𝐎 𝑂 𝙾 𝒪 𝑶 𝓞 𝕆 𝖮 𝗢 𝘖 𝙊 Ο ο σ
㚷 伱 你 倪 呢 妮 妳 尼 您 拟 昵 汝 沵 泥 祢 迩 铌 鉨 your you 亻尓 女尓 ni
㐷 吗 嘛 妈 娘 嫲 嬷 杩 溤 犘 犸 玛 痲 码 祃 蔴 蚂 马 骂 鰢 鷌 麻 嚒 ma

敏感词相关文章

1、敏感词过滤方案那些事

2、普通公司敏感词审核制度

3、新人小白过滤敏感词方案

4、网络常用敏感词过滤方法

5、ToolGood.Words算法过滤敏感词优化原理

6、敏感词过滤中常遇的几个问题

MIT License Copyright (c) 2020 ToolGood Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
C#
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/wotongnian_303658631/ToolGood.Words.Pinyin.git
git@gitee.com:wotongnian_303658631/ToolGood.Words.Pinyin.git
wotongnian_303658631
ToolGood.Words.Pinyin
ToolGood.Words.Pinyin
master

搜索帮助