200分,大家帮帮忙,关于拼音索引,有思路者就有分

fq_ln 2004-01-15 12:34:43
本人要做一个拼音索引的数据库查询,寻求一个解决办法:

根据用户输入的中文信息把每个中文字的首字母提取出来

比如输入:"微软拼音",则用程序生成:wrpy

请各位高手帮帮忙吧,多谢了
...全文
114 44 打赏 收藏 转发到动态 举报
写回复
用AI写文章
44 条回复
切换为时间正序
请发表友善的回复…
发表回复
hunter4500 2004-01-31
  • 打赏
  • 举报
回复
┏━┓┃春节快乐┃┏━┓
┃欢┃┗━━━━┛┃万┃
┃欢┃ ━  ━━ ┃事┃
┃喜┃━┳━┏━┓┃如┃
┃喜┃┃┃┃┗━┛┃意┃
┃迎┃┃┃┃┏┳┓┃度┃
┃猴┃ ┃ ┃╋┃┃春┃
┃年┃ ┛ ┗┻┛┃节┃
┗━┛      ┗━┛
qwater 2004-01-20
  • 打赏
  • 举报
回复
实际应用中更多的是用拼音首字母定位下拉选择框中的汉字
laiwensiji 2004-01-20
  • 打赏
  • 举报
回复
我有。
jimh 2004-01-20
  • 打赏
  • 举报
回复
搞一个汉字库就行,重音的问题也就解决了。
tommyhuanglei 2004-01-19
  • 打赏
  • 举报
回复
学习!
98049522 2004-01-19
  • 打赏
  • 举报
回复
我以前弄過,是對用戶輸入德用戶名取得其拼音縮寫。
記得在網上弄了個子碼對應表
1979xt 2004-01-19
  • 打赏
  • 举报
回复
学习收藏
turnmissile 2004-01-19
  • 打赏
  • 举报
回复
不是很明白你的意思,如果只是用拼音来查询词组的话,为什么不用hashTable来查,每个拼音对应一个hashCode,一个hashCode对应一个链表,里面是所有具有相同hashCode的词组。然后先勇hashcode查询,然后在连表中一一对应的查找。
fq_ln 2004-01-19
  • 打赏
  • 举报
回复
我再顶
sillyer 2004-01-17
  • 打赏
  • 举报
回复
acewang(平平安安过一年) 和以下好几位的贴子我觉得都行得通,这个问题的关键是找到微软汉字库的编码原则,例如字库在45217到45252为"A"为声母的....

考虑这个问题还要考虑操作系统,因为Win98和Win2000的字库不一样,unix等等更不一样。
veaven 2004-01-17
  • 打赏
  • 举报
回复
好贴,顶
ghostboy1020 2004-01-17
  • 打赏
  • 举报
回复
学习啊,呵呵能不能先把字一个个的放如数据库,然后根据发音来判断??
我记得有SQL可以判断发音的,好象是?……
不好意思我是水货
提提意见而已
hehaorome 2004-01-17
  • 打赏
  • 举报
回复
弓虽贝占!!Up!!
wey1996 2004-01-17
  • 打赏
  • 举报
回复
解决同音字?恐怕很难吧!
peterlee168 2004-01-16
  • 打赏
  • 举报
回复
学习
fgc5201314 2004-01-16
  • 打赏
  • 举报
回复
上面那段代码很容量改成C#的~~
ftp://qydn.vicp.net 也有一份 汉字拼音首字母.xls 可供参考啊~~
fgc5201314 2004-01-16
  • 打赏
  • 举报
回复
以前我用VB做过..
Public Function py(mystr As String) As String
If Asc(mystr) < 0 Then
If Asc(Left(mystr, 1)) < Asc("啊") Then
py = "" 'mystr
Exit Function
End If

If Asc(Left(mystr, 1)) >= Asc("啊") And Asc(Left(mystr, 1)) < Asc("芭") Then
py = "a"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("芭") And Asc(Left(mystr, 1)) < Asc("擦") Then
py = "b"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("擦") And Asc(Left(mystr, 1)) < Asc("搭") Then
py = "c"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("搭") And Asc(Left(mystr, 1)) < Asc("蛾") Then
py = "d"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("蛾") And Asc(Left(mystr, 1)) < Asc("发") Then
py = "e"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("发") And Asc(Left(mystr, 1)) < Asc("噶") Then
py = "f"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("噶") And Asc(Left(mystr, 1)) < Asc("哈") Then
py = "g"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("哈") And Asc(Left(mystr, 1)) < Asc("击") Then
py = "h"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("击") And Asc(Left(mystr, 1)) < Asc("喀") Then
py = "j"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("喀") And Asc(Left(mystr, 1)) < Asc("垃") Then
py = "k"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("垃") And Asc(Left(mystr, 1)) < Asc("妈") Then
py = "l"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("妈") And Asc(Left(mystr, 1)) < Asc("拿") Then
py = "m"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("拿") And Asc(Left(mystr, 1)) < Asc("哦") Then
py = "n"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("哦") And Asc(Left(mystr, 1)) < Asc("啪") Then
py = "o"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("啪") And Asc(Left(mystr, 1)) < Asc("期") Then '''qi
py = "p"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("期") And Asc(Left(mystr, 1)) < Asc("然") Then ''ra
py = "q"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("然") And Asc(Left(mystr, 1)) < Asc("撒") Then '''sa
py = "r"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("撒") And Asc(Left(mystr, 1)) < Asc("塌") Then '''ta
py = "s"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("塌") And Asc(Left(mystr, 1)) < Asc("挖") Then '''wa挖
py = "t"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("挖") And Asc(Left(mystr, 1)) < Asc("昔") Then ''''''xi昔
py = "w"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("昔") And Asc(Left(mystr, 1)) < Asc("压") Then '''''ya
py = "x"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("压") And Asc(Left(mystr, 1)) < Asc("匝") Then ''''za匝
py = "y"
Exit Function
End If
If Asc(Left(mystr, 1)) >= Asc("匝") Then ''''za
py = "z"
Exit Function
End If
Else
If UCase(mystr) <= "Z" And UCase(mystr) >= "A" Then
py = Left(mystr, 1)
Else
py = "" ''mystr
End If
End If
End Function
fq_ln 2004-01-16
  • 打赏
  • 举报
回复
delphi的都来了,不错,但还是不能解决多音字问题啊,先谢谢啦,

希望大家接着讨论,看还有没有更好的方案!
chuanke 2004-01-16
  • 打赏
  • 举报
回复
关注
fq_ln 2004-01-16
  • 打赏
  • 举报
回复
再顶
加载更多回复(24)

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧