拼音检索
来源:互联网 发布:js将对象转换成数组 编辑:程序博客网 时间:2024/04/26 17:59
当我们遇到要处理汉字和拼音之间的转化关系怎么办?如和用程序来实现?
我搜索到一个ChineseChar开发包,然后实现了这一难题
using System;
using Microsoft.International.Converters.PinYinConverter;
namespace 拼音基础
{
class Program
{
static void Main(string[] args)
{
#region 判断是否为同音字
ChineseChar chineseChar = new ChineseChar('微');
Console.WriteLine("Stroke number of 微 in Chinese is {0}.", chineseChar.StrokeNumber);
Console.WriteLine("{0} characters' pinyin is \"wei1\".", ChineseChar.GetHomophoneCount("wei1"));
if (ChineseChar.IsHomophone('微', '薇'))
{
Console.WriteLine("微 and 薇 have the same pinyin.");
}
else
{
Console.WriteLine("微 and 薇 have different pinyins.");
}
#endregion
ChineseChar char1 = new ChineseChar('单');
bool f = ChineseChar.IsHomophone('杨','洋');
Console.Write("杨和洋是否为同音字"+f);
Console.Write("\n单是否为多音字:"+char1.IsPolyphone);
char[] chars = ChineseChar.GetChars("ji3");//要加上声调
foreach (char c in chars)
{
Console.Write(c + " ");
}
for (int i = 0; i < char1.PinyinCount; i++)
{
string s=char1.Pinyins[i];
Console.WriteLine(s);
}
//判断是否是一个拼音字符串
Console.WriteLine("de是否是一个合法的拼音"+ChineseChar.IsValidPinyin("de1"));//1,2,3,4表示声调
#region 输入一段中文,写出拼音
string str = Console.ReadLine();
foreach (char c in str)
{
if (ChineseChar.IsValidChar(c))
{
ChineseChar cc = new ChineseChar(c);
Console.Write(cc.Pinyins[0] + " ");
}
else
{
Console.Write(c);
}
}
#endregion
Console.Read();
}
}
}
- 拼音检索
- 拼音检索
- 关于拼音检索字符
- .net实现拼音检索
- 拼音首字母检索
- 自定义拼音检索控件
- solr4.9 拼音检索
- solr拼音检索
- iOS 通讯录拼音检索
- select实例,拼音检索
- solr 拼音检索
- Solr之拼音检索。
- php拼音检索
- C# 通过拼音检索中文名称
- 让coreseek支持拼音检索
- android 拼音快速检索ListView
- 让coreseek支持拼音检索
- jsp—拼音检索中文
- 使用超链接来发送邮件
- 在JSP环境中利用Commons-fileupload组件实现文件上传
- 交换机常用命令
- undo 回滚段,REDO,日志,SCN,DBWRIT,恢复,CHECKPIONT
- [SEO基础知识] 对于Title标签中常见的分隔符的介绍
- 拼音检索
- 【解决】SPECCPU编译出错“f951: error: argument to '-O' should be a non-negative integer”
- java变量修饰符volatile的使用和性能
- CKEditor+CKFinder+JSP实现在线编辑器上传文件(包括图片、flash)
- hibernate里createSQLQuery
- 在struts2中实现文件上传(以图片上传为例)
- Java传参的值传递和引用传递问题(转)
- mysql分组排序查询
- 冒泡排序