vb.net中文分词 vbnet字典类型

VB.NET 如何将"\u5E93\u59C6"转为汉字Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(unicode2hz("\u59C6"))
End Sub
Function unicode2hz(ByVal uni As String) As String
uni = uni.Replace("\u", "")
Dim arr(1) As Byte
arr(1) = Convert.ToByte(Convert.ToInt16(uni.Substring(0, 2), 16))
arr(0) = Convert.ToByte(Convert.ToInt16(uni.Substring(2), 16))
unicode2hz = System.Text.Encoding.Unicode.GetString(arr)
End Function
vb.net怎么做中文语音识别程序这就要调用API函数vb.net中文分词了
给vb.net中文分词你代码吧
记得给点分啊
Private
Const
KeysM
=
H8000
Private
Declare
Function
GetAsyncKeyState
Lib
"user32"
(ByVal
vKey
As
Long)
As
Integer
Private
Sub
TextBox1_KeyDown(ByVal
sender
As
Object,
ByVal
e
As
System.Windows.Forms.KeyEventArgs)
Handles
TextBox1.KeyDown
Me.Text
=
e.KeyValue
If
e.KeyValue
=
Keys.ShiftKey
And
GetAsyncKeyState(160)
And
KeysM
Then
MsgBox("你按vb.net中文分词的是左SHIFT")
ElseIf
e.KeyValue
=
Keys.ShiftKey
And
GetAsyncKeyState(161)
And
KeysM
Then
MsgBox("你按vb.net中文分词的是右SHIFT")
【vb.net中文分词 vbnet字典类型】End
If
End
Sub
vb.net 2008 如何将简体中文跟繁体中文互转呢?原来还有这么个功能,那有没有转换为拼音的方法?
我比你运气好,两个都有效:
Public Class Form1
Private Declare Function LCMapString Lib "kernel32" Alias "LCMapStringA" (ByVal Locale As Integer, ByVal dwMapFlags As Integer, ByVal lpSrcStr As String, ByVal cchSrc As Integer, ByVal lpDestStr As String, ByVal cchDest As Integer) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cString As String = "中华人民共和国"
cString = (StrConv(cString, VbStrConv.TraditionalChinese))
MsgBox(cString)
cString = (StrConv(cString, VbStrConv.SimplifiedChinese))
MsgBox(cString)
Dim rString As String = Space(14)
LCMapString(H804, H4000000, cString, 14, rString, 14)
MsgBox(rString)
cString = rString
LCMapString(H804, H2000000, cString, 14, rString, 14)
MsgBox(rString)
End Sub
End Class
StrConv参数不对,api 函数Long型要改为Integer类型 。
如何用vb.net将汉字转换成拼音阿public string hz2py(string hz)//获得汉字的区位码
{
byte[] sarr = System.Text.Encoding.Default.GetBytes(hz);
int len = sarr.Length;
if (len1)
{
byte[] array = new byte[2];
array = System.Text.Encoding.Default.GetBytes(hz);
int i1 = (short)(array[0] - '\0');
int i2 = (short)(array[1] - '\0');
//unicode解码方式下的汉字码
//array = System.Text.Encoding.Unicode.GetBytes(hz);
//int i1 = (short)(array[0] - '\0');
//int i2 = (short)(array[1] - '\0');
//int t1 = Convert.ToInt32(i1,16);
//int t2 = Convert.ToInt32(i2,16);
int tmp=i1*256+i2;
string getpychar="*";//找不到拼音码的用*补位
if(tmp=45217tmp=45252){getpychar= "A";}
else if(tmp=45253tmp=45760){getpychar= "B";}
else if(tmp=47761tmp=46317){getpychar= "C";}
else if(tmp=46318tmp=46825){getpychar= "D";}
else if(tmp=46826tmp=47009){getpychar= "E";}
else if(tmp=47010tmp=47296){getpychar= "F";}
else if(tmp=47297tmp=47613){getpychar= "G";}
else if(tmp=47614tmp=48118){getpychar= "H";}
else if(tmp=48119tmp=49061){getpychar= "J";}
else if(tmp=49062tmp=49323){getpychar= "K";}

推荐阅读