成功应用HMM模型建立一个整句模块 十一月 29th, 2011
经过一段时间的编写和一位前辈的指点,终于成功应用HMM模型做了一个中文全拼的整句模型,初步应用下来效果非常好。
1.环境说明:
- 现在的模型是基于Sogou提供的语料库,自己进行加工处理以后得到的1,2,3元数据库。
- 3元数据共计69169571条记录,所有记录在整个语料库里出现次数大于60,容量691MB;
- 2元数据共计7541447条记录,所有记录在整个语料库里出现次数大于50,容量60MB;
- 1元数据共计28800条记录,包含标点符号和多音字,多音字已经经过手工处理,对其频率按照拼音的常用度做了调整;
录入:pinlv
Indexes: 1 2 频率 7.21109e-06
Indexes: 0 3 品绿 1.10924e-06
Indexes: 0 0 品旅 3.70556e-07
Indexes: 0 2 品率 2.55166e-07
Indexes: 0 1 品律 1.39261e-07
Indexes: 1 0 频旅 1.36979e-07
Indexes: 1 1 频律 9.14216e-08
Indexes: 2 0 聘旅 8.46383e-08
这个结果和Sogou拼音输入法的结果差不多。
3.三元模型测试结果
Indexes: 36 12 7 解开了 4.40488e-07
Indexes: 31 12 7 揭开了 2.86371e-07
Indexes: 41 12 7 结开了 1.65645e-08
Indexes: 40 12 7 接开了 9.09285e-09
Indexes: 35 12 7 街开了 6.50801e-09
Indexes: 39 12 7 界开了 4.38874e-09
Indexes: 38 12 7 节开了 4.04084e-09
Indexes: 34 12 7 姐开了 3.70204e-09
Indexes: 33 12 7 杰开了 1.73701e-09
Indexes: 30 12 7 届开了 1.18893e-09
基本符合预期结果。
4.整句测试
基于现有模型,我打算进行一些测试,我找来了一些测试语句,分别是微软拼音和QQ拼音分别错误的地方:
QQ拼音
人事部门指的是人事局或组织部。区别在于:如果基层单位是党委部门单位,则全部的人事资料上报到组织部,或者其他单位当中的行政职务等级高于副县级以上级别的人员人事档案同样商报组织部,除了以上的人员以外的其他人事档案都将报送人事局。这部分工作由系统自动识别完成。
微软拼音
人事部门指的是人事局或组织部。区别在于:如果基层单位时档位部门单位,则全部的人事资料上报到组织部,或者其他单位当中的行政职务等级高于副县级以上级别的人员人事档案同样上报组织部,除了以上的人员以外的其他人事档案都将保送人事局。这部分工作由系统自动识别完成。
输入:ren shi dang an tong yang shang bao zu zhi bu
Indexes: 0 4 1 2 1 0 0 0 0 18 1 人事档案同样上报组织部 9.02986e-23
Indexes: 0 4 1 2 1 0 1 0 0 18 1 人事档案同样商报组织部 1.56198e-23
Indexes: 0 4 1 2 1 0 0 2 0 18 1 人事档案同样上保组织部 6.38265e-24
Indexes: 0 4 1 2 1 0 0 0 0 18 0 人事档案同样上报组织不 5.64048e-24
Indexes: 0 4 1 2 1 0 3 2 0 18 1 人事档案同样伤保组织部 3.63851e-24
Indexes: 0 4 1 2 1 0 0 0 0 18 2 人事档案同样上报组织布 3.00101e-24
Indexes: 0 4 1 2 1 1 1 0 0 18 1 人事档案同阳商报组织部 1.41729e-24
Indexes: 0 4 1 2 1 0 1 0 0 18 0 人事档案同样商报组织不 9.75684e-25
输入:ru guo ji ceng dan wei shi dang wei bu men dan wei
Indexes: 1 2 5 0 0 1 0 2 7 1 1 0 1 如果基层单位是党委部门单位 7.45283e-27
Indexes: 1 2 5 0 0 1 1 2 7 1 1 0 1 如果基层单位时党委部门单位 1.94597e-27
Indexes: 1 2 5 0 0 1 6 2 7 1 1 0 1 如果基层单位实党委部门单位 4.84873e-28
Indexes: 1 2 5 0 0 1 24 0 0 1 1 0 1 如果基层单位适当为部门单位 3.30176e-28
Indexes: 1 2 5 0 0 1 24 0 1 1 1 0 1 如果基层单位适当位部门单位 2.49812e-28
Indexes: 1 2 5 0 0 1 13 2 7 1 1 0 1 如果基层单位使党委部门单位 2.15916e-28
Indexes: 1 2 5 0 0 1 0 0 0 1 1 0 1 如果基层单位是当为部门单位 1.89779e-28
输入: qi ta ren shi dang an dou jiang bao song ren shi ju
Indexes: 1 0 0 4 1 2 0 1 0 1 0 4 5 其他人事档案都将报送人事局 3.40709e-27
Indexes: 1 0 0 4 1 2 0 1 2 1 0 4 5 其他人事档案都将保送人事局 1.39499e-27
Indexes: 1 0 0 4 1 2 0 1 3 1 0 4 5 其他人事档案都将包送人事局 1.21096e-27
Indexes: 1 2 0 4 1 2 0 1 0 1 0 4 5 其它人事档案都将报送人事局 7.66649e-28
Indexes: 1 0 0 4 1 2 0 1 0 1 0 14 0 其他人事档案都将报送人士告 4.06554e-28
Indexes: 1 2 0 4 1 2 0 1 2 1 0 4 5 其它人事档案都将保送人事局 3.13894e-28
三个结果都正确,真是太令人兴奋了!!!!!
5.有关标点符号
原来在使用微软拼音的时候,总是觉得它的转换成功率不是很高,但总是看到报道说其成功率很高,于是纳闷。
这两天调试HMM模型终于明 白了,原来,我在使用微软拼音输入时还是按照原来使用词组类输入法的习惯,每输入几个字词就用空格确认一下,而标点符号是单独输入的,比如输入“今天天气 不错,我想出去拍照”,当输入到“不错”的时候,我就会习惯性的按下空格来确认前面的内容,然后再输入“,”。
但对于整句模型来说“,”是一个很重要的上下文元素,它对整句的识别成功率有重大的影响,比如我要输入“下一步是组合和锁紧,然后就...”,如果没有“,”,HMM模型得到的结果是:
Indexes: 0 0 3 0 0 1 0 1 1 下一步是组合和所进 4.16576e-22
Indexes: 0 0 3 0 0 1 0 2 1 下一步是组合和缩进 2.81505e-22
Indexes: 0 0 3 0 0 1 0 3 7 下一步是组合和锁紧 2.18722e-22
Indexes: 0 0 3 0 0 1 0 1 0 下一步是组合和所金 4.19147e-23
Indexes: 0 0 3 0 0 1 0 1 8 下一步是组合和所禁 2.05883e-23
Indexes: 0 0 3 0 0 1 0 1 2 下一步是组合和所今 1.59433e-23
第一个记录显然不是我们想要的,因为“所进”的概率显然高于“锁紧”这个组合,再没有下文的前提下,模型只能按照最大可能性组合出句子,但我们如果加入了“,”,表明这句话已经结束了,那HMM模型给出的组合就完全不一样了:
Indexes: 0 0 3 0 0 1 0 3 7 0 下一步是组合和锁紧, 1.71357e-23
Indexes: 0 0 3 0 0 1 0 1 1 0 下一步是组合和所进, 1.69333e-24
Indexes: 0 0 3 0 0 1 0 2 1 0 下一步是组合和缩进, 1.17429e-24
Indexes: 0 0 3 0 0 1 0 2 7 0 下一步是组合和缩紧, 7.90322e-25
Indexes: 0 0 3 0 0 1 0 1 3 0 下一步是组合和所近, 4.10302e-25
Indexes: 0 0 3 0 0 1 0 1 8 0 下一步是组合和所禁, 1.43344e-25
因为“所进”虽然概率高,但“所进”后面跟一个“,”的概率就很低了,相反“锁紧”后面跟“,”的概率显然要高得多,于是HMM模型就能正确识别用户的意图了。
这里说这么多,其实就是想说,整句输入不仅仅要靠程序更加智能,还要用户的输入习惯进行配合,才能发挥出最大的功效。
有人说我用twitter的同时又用百度的空间有点范2的表现 十一月 29th, 2011
于是我打算恢复使用google的空间。
The download server was recovered 四月 30th, 2011
After 3 weeks of working, the sinomac server was recovered :-) Thanks macres' hard working.
IMKQIM 1.9.6 1C376 for SnowLeopard Beta 二月 10th, 2011
The primary goal is to solve overload memory usage in some user's computer, I hope this version can reduce to 25-50MB memory usage.
The over features is:
1、在IMKQIM设置的“高级”里添加了修改标点符号映射关系功能;
2、在IMKQIM设置的“高级”里添加了“在所有的Spaces里显示Sogou状态条”功能;
3、在IMKQIM设置的“高级”里添加了“当关闭计算机时自动切换到ASCII的输入源”功能;
4、修订了Sogou皮肤横排模式下的一些显示问题;
Download Link:http://glider.ismac.cn/IMKQIM_1_9_6_SogouDict_1C378_SL.dmg.zip ( Only Support Snow Leopard )
IMKQIM 1.9.5 Released 十二月 30th, 2010
IMKQIM can not work in MacOS 10.5.8, the problem is NSAutoreleasePool, it free a working object. But.. Why it works in Mac OS 10.6?
Another improvement is Sogou skin, the candidate bar will work more compatible with Sogou skin files. I won't support Animated skin file in recent release. In fact many uses do not care about the Sogou skin.. (sign...), it seems that most users like simple interface.
I've upload ID3Mod to App Store, but the contract info still in processing.... Do I missing something?
IMKQIM 1.9.3 Build 1C227 Released 十二月 3rd, 2010
Fix the bug that the candidate bar will disappear....
Candidate Bar disappear!!!! 十二月 1st, 2010
That's my mistake. The solution is :
1. Open IMKQIM Preferences
2. Close 'Check for updates automatically'
3. Logout & Login.
I'll fix the bug and release a new version in recent days. Sorry for the inconveniences.
IMKQIM 1.9.2 1C203 Already released 十一月 28th, 2010
IMKQIM and IMKQIMCandidateWindow process will slow down the system....
I recommend all IMKQIM users upgrade to this version ASAP.....
IMKQIM 1.9.2 will be released soon 十一月 25th, 2010
The bug is everywhere ...., I admit. There are too much work to do.
Why I remove Plug-In code table in IMKQIM 1.9, some users asked me. Hm... In fact, this feature is not removed, but I want to improve them, I want to design a flex and powerful platform. I'll reopen this feature in the future release of IMKQIM 1.9.
穿越... Back.To.The.Future 十一月 12th, 2010
'穿越' is a very popular subject for Chinese network novles. While, because there is no limitation, this kind of novle always has great imagination. The leading actor maybe a famous people in the past or has great power or has many beautiful wifes or blablabla ....
Because the actor has the morden knowledge, so he/she always break the rules or making miracles ... Such as open a beauty salon in Qing dynasty, draft pick in the royal palace, build a submarine to defeat the enemy amrada ...
Many people enjoy with this subject and they get fun from them. But after read many novles like this, I'm tired out. ....
