使用微软语言包实现汉字转拼音
2014-05-16 18:12
375 查看
网上有很多汉字转拼音的方案,但并不知道性能和可靠性如何。所以本着选择权威的原则,还是想找一个官方的解决方案。下面实用微软官方的语言包实现汉字转拼音。
下载地址:http://www.microsoft.com/downloads/zh-cn/details.aspx?FamilyID=44cac7f0-633b-477d-aed2-99aee642fc10&DisplayLang=zh-cn
此安装包包含日语、汉语、韩语等多种语言,选择安装CHSPinYinConv.msi。完成之后在项目中引用安装目录中的ChnCharInfo.dll即可。
下面就是实现汉字转拼音的demo
下载地址:http://www.microsoft.com/downloads/zh-cn/details.aspx?FamilyID=44cac7f0-633b-477d-aed2-99aee642fc10&DisplayLang=zh-cn
此安装包包含日语、汉语、韩语等多种语言,选择安装CHSPinYinConv.msi。完成之后在项目中引用安装目录中的ChnCharInfo.dll即可。
下面就是实现汉字转拼音的demo
using Microsoft.International.Converters.PinYinConverter; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Suspects.Dll.Util { publicclassPinYinUtil { //返回字符串的简拼 publicstaticstring getSimplePinYin(stringinputTxt) { string shortR =""; foreach (char cin inputTxt.Trim()) { ChineseChar chineseChar =newChineseChar(c); shortR +=chineseChar.Pinyins[0].Substring(0, 1).ToLower(); } return shortR; } //返回字符串全拼 publicstaticstring getAllPinYin(string inputTxt) { string allR =""; foreach (char cin inputTxt.Trim()) { ChineseChar chineseChar =newChineseChar(c); allR += chineseChar.Pinyins[0].Substring(0,chineseChar.Pinyins[0].Length - 1).ToLower(); } return allR; } } }
相关文章推荐
- 微软语言包实现汉字转拼音
- C#使用微软语言包来获取中文汉字的拼音、拼音首字母、中文繁体
- ASP.NET Core使用微软官方类库实现汉字转拼音
- ASP.NET Core使用微软官方类库实现汉字转拼音
- C# 使用微软的Visual Studio International Pack 类库提取汉字拼音首字母
- 使用微软的 Visual Studio International Pack 1.0 进行网站简体与繁体的互转和得到汉字、拼音、笔画等相关信息
- C# 使用微软的Visual Studio International Pack 类库提取汉字拼音首字母
- 使用微软的 Visual Studio International Pack 1.0 进行网站简体与繁体的互转和得到汉字、拼音、笔画等相关信息
- C# 使用微软的Visual Studio International Pack 类库提取汉字拼音首字母
- C# 使用微软的Visual Studio International Pack 类库提取汉字拼音首字母
- C# 使用微软的Visual Studio International Pack 类库提取汉字拼音首字母
- 使用微软的 Visual Studio International Pack 1.0 进行网站简体与繁体的互转和得到汉字、拼音、笔画等相关信息
- 使用微软的 Visual Studio International Pack 1.0 进行网站简体与繁体的互转和得到汉字、拼音、笔画
- AutoCompleteTextView输入汉字拼音首字母实现过滤提示(支持多音字,Filterable的使用)
- J2EE 使用pinyin4j实现汉字转换拼音
- C# 使用微软的Visual Studio International Pack 类库汉字转拼音
- 使用微软的 Visual Studio International Pack 1.0 进行网站简体与繁体的互转和得到汉字、拼音、笔画等相关信息
- C# 使用微软的Visual Studio International Pack 类库提取汉字拼音首字母
- C# 使用微软的Visual Studio International Pack 类库提取汉字拼音首字母
- C# 使用微软的Visual Studio International Pack 类库提取汉字拼音首字母