基于历史记录的超长拼音输入法_第1页
基于历史记录的超长拼音输入法_第2页
基于历史记录的超长拼音输入法_第3页
基于历史记录的超长拼音输入法_第4页
基于历史记录的超长拼音输入法_第5页
已阅读5页,还剩20页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

题目:基于历史记录的超长拼音输入法学生姓名: 学生学号: 专 业: 指导教师: 学院(系): 基于历史记录的超长拼音输入法摘要中文输入法是中文信息处理的重要组成部分,也是中文操作系统的计算机人机交互的重要环节。在学术界和工业界都有着很高的地位,大型的互联网公司和软件开发公司都在SunPiyinSunPinyinWindows关键词:中文拼音输入法,历史记录,超长预测基于历史记录的超长拼音输入法基于历史记录的超长拼音输入法THELONGESTFORECASTPINYININPUTMETHODBASEDONHISTORICALRECORDABSTRACTChineseInputMethodplaysanimportantroleinChineselanguageprocessing,andisakeyfactorofhuman-computerinteractionforChinese.IthashighstatusinacademiaandLargeInternetcompaniesandsoftwaredevelopmentcompaniesaredevelopingtheirowninputmethodproduct.DuringalltheChinesepinyininputmethod,theSunPinyininputmethodisthebestonewhichisopensource.Inthisarticle,wechooseSunPinyinasthekernelofthenewChinesepinyininputmethodonWindows.Basedonthis,wechoosesegmentationalgorithmtoanalysisthehistoricalrecord,whichisthemostimportantpartoftoimplementthelongestforecastChinesepinyininputmethodbasedonhistoricalrecord.FposedevaluationsystemforChineseinputmethodbasedonkeystrokecountfromtheviewofuserexperience.Itprovethatthenewinputmethodpreformquitewell.Keywords:ChinesePinyinInputMethod,HistoricalRecord,LongestForecast目录第一章1研究义 1研究景 1研究容 2论文构 2第二章Windows输的构技术 3IME3IME架现 3音入的计 4入安装 5章结 5第章SunPinyin入法 6SunPinyin输法 6SunPinyin输法擎 7SunPinyin移植 8UCS-4转字 9章结 9第四章于史录音预算法 10入历记分析 10史录析长测算(HRAP) 10章结 13第五章入评测 14验境 14验果 14第六章结展望 16谢辞 18第第18页共18页第一章绪论研究意义17([1]研究背景[2][3][4]使用[5][6]SunPinyinSunPinyinSunPinyin研究内容本文的研究分为三个方面:WindowsWindowsSunPinyinSunPinyinSunPinyin进一步研究。以SunPinyin输入法作为输入法的内核,实现下的SunPinyinSunPinyinSunPinyinLinuxWindows论文结构本文接下来的章节安排如下:第二章WindowsWindowsSunPinyinLinuxSunPinyinWindows操作系统上,在Windows上实现SunPinyin输入法。第二章Windows下输入法的构建技术Windows下输入法的实现主要有两种方法:本文采用基于输入法框架的方式实现。IME(Hook)在Windows95以后,微软提出了输入法管理器输入法生成器(InputMethodManager-InputMethodIMM-IMEAPIIMM-IMEWindowsXPTS(extSeceaeokMMEWindowsTSF请IMM-IMEAPIIMM-IMEIMM-IME框架的原理是当前活动窗口开启输入法之后,键盘和鼠标等事件就会通过系统进程用户界面模块转交给IME处理,IME再转交给当前输入法处理,处理的结果返还给IME,IME根据结果反馈给用户界面模块。之后由用户界面模块交给应用程序的活动窗口IME与输入法框架相关基本概念有:(nputModMngerMndos(nputModEdiorMEMEIME.ime(nputConexndosUSER.exe基于历史记录的超长拼音输入法基于历史记录的超长拼音输入法(,实现一个输入法程序的主要工作就是完善输入法编辑器,实现输入法必需的API接口。对于一个输入法编辑器,它由两部分组成:ME(MEConesonneaceWindowsME(MEUsrneacIMMIME转换界面主要是几个API接口函数的实现,对于一个键盘输入法来说,有四个函数是必须要实现:IMEINFOIMEIMEcoposonndo)canddaendo。最进入整句输入模式后,输入法的界面并没有发生太大的变化。它在字典查询的基础上对于一个现代的输入法而言,它提供的界面必须实现以下交互:输入法安装IMEDDLWindowsAPISystem32输入法安装调用的接口是ImmInstallIME,这个API是一个特定的注册输入法的函API本章小结本章中,我们介绍在Windows下建立输入法需要的框架以及实现一个输入法所需要实现的功能。通过框架和设计,我们可以实现一个在Windows下的简单的输入法。第三章SunPinyin输入法WindowsLinuxSunPinyinWindowsSunPinyin是所有开源的输入法中应用最广的。要在Windows下使用SunPinyin输入法,需要对SunPinyin输入法进行代码移植。SunPinyinSunPinyinMacLinuxSUN亚洲研究中心为OpenSolaris开发的基于统计学语言模型的输入法。统计语言模型(LanguageNNgamModHddnMovModHM、(MaximumEntropyModel)SunPinyinNN-gramN-gramWnWw1w2…wnWP(W)P(W)P(W)=P(w1)P(w2|w1)P(w3|w1w2)…P(wn|w1w2…wn-1)从上式可以得出,要计算出出词wn的出现概率,必须首先获得它前面的词出现概率。这样计算是有困难的,通过简化问题,可以更容易的计算出该值。win-1N(N-gramP(W)=P(w1)P(w2|w1)P(w3|w1w2)…P(wi|wi-N+1…wi-1)…≈i=1,…,nP(wi|wi-N+1wi-1)符号i=1,…,nP(…)表示概率的连乘。在实际使用中,二元模型(bi-gram)和三元模型(tri-gram)NSunPinyin输入法是基于三元模型实现,即在其中的任意一个词出现的概率仅与它之前的两个词相关。有:

P(W)≈i=1,…,nP(wi|wi-2w-1)公式中的参数可以通过一个语料库训练的到。这时公式可转化为:P(wi|wi-2wi-1)≈count(wi-2wi-1wi)/count(wi-2wi-1)式中count(…)表示一个特定序列的词在整个语料库中出现的次数。SunPinyin概念模型ime\src\slmback-off(回退N-gram(NSunPinyinime\src\lexiconeyeengmSyllableSegmentorcandidates中列出所有候选词。在用户提交(commit)候选句(或词)之后,它要更新历史缓存来记LatticeBuilderLatticeLatticeSyllableSegmentorminganming’anmin’ganSyllableGraphLatticeBuilder。LatticeBuilder(LatticeLatticeLatticeLatticeHistoryCache:历史缓存,记录用户最近提交的候选词。这里使用的是一个类似bi-gram的模型。在计算P(z|xy)时,用Psmooth(z|xy)和Pcache(z|y)来插值得到。而Pcache(z|y),是P(z|y)的MLE(MaximumLikelihoodEstimation),和P(z)的MLE的插值。SunPinyinCBone/CskeletonlatticeBone对应一个sllale(或者严格的说,是一个sgmnt,而CSeeon是Boe的双向链表(sdsunPnin2latiesyllableSunPinyin2CLatticeCSkeletonCBone/CBoneInnerDataCLatticeFrame。其它的像TLexiconStateTLatticeState基本没有变化,仅把位置信息从iterator换成了index。另外为了支持用户词典,在TLexiconState加入了一些相应的字段,例如m_words,m_syls。用户词典SunPinyinHistoryCachebi-gramunigramunigram在SunPinyin2中,通过sqlite3实现用户词典,目前的输入法模型支持词的长度不超过6。SunPinyinSunPinyin输入法是Linux下的输入法,它的整体实现都是基于Linux,并没有提供WindowsSunPinyinWindowsSunPinyinCndos和nuxStudio2013WindowsC++DEBUGSunPinyinSunPinyinLinux下,SunPinyinSconsSconsPythonmakeSconsLinuxVS2013SunPinyinSunPinyin从网上得到的词典和训练模型并不能直接使用,这些文件都是UTF-8格式。但在实际SunPinyinLinuxLinux下,Scons文件LinuxLinuxWindows基于历史记录的超长拼音输入法基于历史记录的超长拼音输入法UCS-4SunPinyinUCS-4SunPinyinLinuxLinux的格式存在,所以提供的转换函数是这两个格式之间的转换。但是这个编码在WindowsGBKUCS-4UnicodeUnicode32位要将UCS-4转换成能在Windows下使用的汉字编码,转换过程如下:UCS-4wstringwstringstring。String中的对象就是UCS4指针第一个位置的32位元所对应的汉字,不断重复上边的操作,就能将一个UCS-4编码的串转成对应的词。本章小结SunPinyinSunPinyinWindows第四章基于历史记录的拼音预测算法SunPinyinWindows在已有的输入法的历史记录分析并不完善,仅在某一些环境中使用历史记录。并且,要实现基于历史记录分析预测的输入法算法,要解决两个重要的问题:针对基于历史记录分词预测的输入法,提出了一个新的算法,叫历史记录分析预测算法,简称HRAP。(HRAP)HRAPHRAP4.2.1中文分词技术2080(oadMxumMchngMhodM、逆向最大匹配算法(BakadMxumMchngMhod,BM、双向最大匹配法(Bi-directionMaximumMatchingMethod,BM)等。正向最大匹配法iii[9]1/169。正向匹配算法描述:(1)NN(2)逆向最大匹配法:分词过程与FMM法相同,不同的是从句子(或文章)末尾开始处理,BMMFMM1/245。双向最大匹配法:使用正向最大匹配法和逆向最大匹配法同时进行分词。比较两种方法的分词结果,以该结果作为分词。据SunM.S.和BenjaminK.T.(1995)的研究表明,中文中90.0%左右的句子,正向最大匹配法和逆向最大匹配法的结果重合且正确,有大概,1.0元文法(N-gram)和隐形马尔科夫(HiddenMarkovModel,HMM)基于历史记录的超长拼音输入法基于历史记录的超长拼音输入法HRAPHRAPMMSEGSunPinyinMMSEGN-gramMMSEG(Simple)和复杂最大匹配方法(Cpex,两种算法都是基于正向最大匹配的。不同之处在于,简复杂最大匹配算法在简单最大匹配上增加了四个规则:1211MMSEG在此基础上,基于统计词频的分词算法就可以帮助我们更好的解决这个问题。HRAP分词算法的实现:MMSEGHRAP分词算法的兼顾了效率和分词的准确率。,HRAP对于不同长度的词,存储方式不一样。对于只有一字的词。不用将其后一个词存入。对于多个字组成的词,每个音节都需存储一遍。HRAP分词结果存储部分:1如果词的字数大于1,1(2)zui zuida pi pipei suan suanfa shi HRAPNNHRAP预测部分:NN4.3第五章输入法评测在本次项目中,选取的实验环境的参数如下:764位;notepad++。MoonPinyin5-1图5-1MoonPinyin输入法效果be”和“n”分别是一次击键。用户选择算一3/2。本次项目中,选取的实验数据信息如下:字数词条数来源9531110000人民日报语料库表5-1实验数据信息通过选取不同的N值,获得一个平均击键次数与词条数的关系图,比较获得一个较为合适的阀值。结果如下图所示。图5-2不同阀值N下的关系图(每100条取一次数据)N115001500条数据以前的数据关系图。每10条词条取一次数据。结果如图5-3.图5-3不同阀值下的关系图(每10条取一次数据)HRAPHRAP基于历史记录的超长拼音输入法基于历史记录的超长拼音输入法第六章总结和展望WindowsLinuxSunPinyinWindowsWindowsWindowsSunPinyinSunPinyin基于历史记录的超长拼音输入法的实现是一个很好的开端,我们可以在这上面进行更加深入的研究:对于SunPinyin输入法,它所提供的语言模型是N-gram静态模型,所有的N-gram“”参考文献LewisMetal.Ethnologue:Languagesoftheworld[M],9.[S.l.]:SILinternationalDallas,TX,2009.ChenZ,LeeKANewStatisticalApproachChinesePinyinInput[C]//Proceedingsofthe38thAnnualMeetingoftheAssociationforComputationalLinguistics.HongKong:AssociationforComputationalLinguistics,2000:241–247.\h/anthology/P00-1031.JiangGuanX,etal.PinYin-to-CharacterConversionModelbasedonSupportMachines[J].JournalofChineseinformationprocessing,2007,21(2):100–105.X,etal.AMaximumEntropyApproachtoChinesePinConversion[C]//Systems,ManandCybernetics,2006.SMC’06.IEEEInternationalConferenceon..[S.l.]:[s.n.],2006,4:2956–2959.X,Xetal.AConditionalRandomFieldsApproachtoChinesePinyin-to-CharacterConversion[J].JournalofCommunicationandComputer,2009,6(4):25–31.S,ZhaoH,Bl.AMachineTranslationApproachforChineseWholeSentencePinyin-to-CharacterConversion[C]//Proceedingsofthe26thPacificAsiaConferenceonLanguage,Information,andComputation.Bali,Indonesia:FacultyofComputerScience,UniversitasIndonesia,2012:333–342.\h/anthology/Y12-1036.ZhengC,SunM.CHIME:AnEfficientError-tolerantChinesePinyinInputMethod[C]//ProceedingsoftheTwenty-SecondInternationalJointConferenceonArtificialIntelligence-Three.[S.l.]:AAAIPress,\h/10.5591/978-1-57735-516-8/IJCAI11-424.DWSJ·198(2:4452.10]J200(102605260.蒋建洪,赵嵩正,罗玫·词典与统计方法结合的中文分词模型的研究与应用[J]·计算201(1:03870391.HMM200883741.[D]·IMM-IME200201:0170120.J201012232.谢辞在此本科设计论文完成之际,我要感谢在这本科四年中在学习和生活中给我提供帮助的老师和同学们。首先,我要感谢赵海老师。作为我设计的指导老师,他早我完成设计的过程中给了我悉心的指导,在遇到困难时给我指出了研究方向,使我能够顺利的完成设计。在和导师的交流中,我对导师的科研热情和严谨的治学态度敬佩不已。他敏锐的思维方式和认真的工作态度,对我产生了很大的影响。其次,感谢王学长,他在毕业的过程中给我提供很多帮助,在遇到问题时,他的回答给我指明了方向。感谢实验室的学长。在设计的过程中提供了指导和意见。再次,我要感谢我的家人和朋友们,感谢你们一直以来对我的帮助和支持。最后,衷心感谢从百忙之中抽出时间来审阅本次毕业论文的导师们!第第3页共3页THELONGESTFORECASTPINYININPUTMETHODBASEDONHISTORICALRECORDChineseisworld'smostpopulouslanguage,whichhasmorethan1.7billionpeopleuseiteveryItisusedinChina,Singapore,Malaysia,Japan,NorthKorea,SouthKorea,Indonesia,Thailand,Cambodia,MyanmarandotheroverseasChineseregions.Amongthis,morethan870millionpeopleuseitasmothertongue.ChineseisnotonlytheofficiallanguageofThePeople'sRepublicofChina,butalsooneoftheworkinglanguageofUnitedNations,whichplaysagrowingpartintheworld.Chinesehasalonghistoryanditisoneoftheoldestlanguageintheworld.Chinaisoneoftheareaswherecivilizationdevelopedearliest.Ithasarecordedhistoryofnearly5,000years.AsthelanguageofChina,Chinesehasdeepculturalbackground.ChineseisapartofChinesecivilization,itrecordsthehistoryofChinesecivilization.Inthesametime,itmakesagreatinfluenceonneighboringcountries.canseealotofChinesewordsinJapanese,KoreanandVietnamese.theadventoftheinformationage,thedevelopmentofChineseisfacinggreatopportunitiesandchallenges.Ononehand,moreandmoretechnologynewwordsarecreated,whichisasmallprobleminChinese.Chineseisphonetic,ideographicandtopographywhichmakeitcansolvetheproblemoftheconstructionofnewwords.Buttothewesternlanguage,creatingnewwordsisabigproblem.Peoplechooselongwordtorepresentnewtechnologywords.Thismaketheyarenoteasytoreadandunderstand.alsoabigproblemtouseitindailylife.Ontheotherhand,Chineseoriginatedinhieroglyphs.Soitcannotdirectlyinputbystandardkeyboard.InordertoinputChineseintocomputer,weneedaprogramnamedinputmethod,whichisusedtoconverttheinputcodesintoChinesecharacter.InputtingChineseintocomputerdependsontheinputmethod.AsthebasicmeanstoinputChinese,inputmethodplaysanimportantroleinChineseinformationprocessingAlotofnews,literatureandotherrecordsareenteredintocomputertoprocess,memoryandspreadeveryAgoodinputmethodcannotonlysavegreatamountofresourceandtime,italsohelpstheculturestospread.ChineseinputmethodisessentialsoftwareofChineseoperatingsystem.Bothacademiaandindustryhavereceivedmuchattentiontoit.SomebigsoftwarecompaniesandInternetcompanieshaveitsowninputmethod,suchasMicrosoft,Google.TherearetwomaincategoriesofChineseinputmethod.Oneisshape-basedinputmethod,suchas"wubizixing",theotherisPinyin,orpronunciation-basedinputmethod,suchas"ChineseCStar","MSPY",etc.Becauseofitsfacilitytolearnandtouse,PinyinisthemostpopularChineseinputmethod.Over97%oftheusersinChinausePinyinforinput.AlthoughPinyininputmethodhassomanyadvantages,italsosuffersfromseveralproblems,includingPinyin-to-charactersconversionerrors,usertypingerrors,andUIproblemsuchastheneedoftwoseparatemodewhiletypingChineseandEnglish,etc.Pinyin-basedmethodautomaticallyconvertsPinyintoChinesecharacters.But,thereareonlyabout406syllables;theycorrespondtoover6000Chinesecharacters.Soitisvery基于历史记录的超长拼音输入法基于历史记录的超长拼音输入法difficultforsystemtoselectthecorrectcorrespondingChinesecharactersautomatically.Intheearlytimes,thePinyininputmethodissimple.Itisadictionarysearchprogram,theuserinputthepinyinandtheprogramsearchthewholedictionarytolistthematchChineseCharacter.SoitcanonlyinputonePinyinandafewofmultiplePinyininput.Withthedevelopmentofinputmethod,anewclassofinputmethodisfound,whichiscalledsentence-basedinputmethods.Thesentence-basedinputmethodsisbasedonstatisticallanguagemode.Instatisticallanguagemode,Pinyin-basedinputmethodismodeledasHiddenmarkovmodel(HMM),observationstatesarepinyinsyllables,hiddenstatesareChinesewords,sothePinyin-basedinputmethodistodecodetheChinesewordsequencefromthepinyinsequence.Inordertosolvetheerroneousinputproblem,Pinyin-basedinputmethodaddtheparterror-tolerant.Thismodeisthemostpopularandisthemainalgorithmofinputmethod.Inthisarticle,weintroducethemajorpartofrealizingalongestforecastpinyin-basedinputmethodbasedonhistoricalrecord.Wedivideitintothreeparts,thisthreepartsarethreephasestoimplementtheinputmethod.ThefirstpartistorealizeasimplePinyin-basedinputmethodonWindows.Therearetwomainwaytoachieveaninputmethod.Oneusesthehook,thisistheearliestItusessystemhookstointerceptinformationformthekeyboard.ThenhookfunctioncanconverttheinformationintoChinesecharactersandsendingthoseChinesecharacterstotheapplication.AnotherwayisuseinputmethodwhichisalsocalledIME.InputMethodManager(IMM)isatechnologyusedbyanapplicationtocommunicatewithaninputmethodeditor(IME),whichrunsasaservice.TheIMEallowscomputeruserstoentercomplexcharactersandsymbols,suchasJapanesekanjicharacters,byusingastandardkeyboard.IMEdefinestheprogrammingspecificationofinputmethod,whichcomposesbysomeWindowsAPI.foundthekeyfunctionAPI,andrealizethem.Duringthewholeproject,statuscandidatewindowandcompositionwindowarethewayhowusercancommunicatewiththeinputmethod.AlltheinputinformationisshowedthosethreeWindows,maketheinputmethodperformwell.ThesecondpartistoCodemigration.AsweallSunPinyinisthebestopensourceinputmethod,andinthisproject,wechooseSunPinyinasthekerneloftheinputmethod.ButSunPinyinisaprograminLinux,wecannotdirectlyuseinWindows.SoweneedCodemigration.SunPinyinisastatisticallanguagemodelbasedChineseinputmethod,whichwasfirstlydevelopedbySunBeijingGlobalizationteam.AnditbasesonN-gram.ForitiscodeinC++,soweneednotchangethecode.ThereareonlyafewfunctionisnotsuitinWindows,wefindthemandchangeintothefunctioninWindows.Duringtheproject,weusestudio2013tohelpdebug.Intheend,weaddtheSunPinyintothesimpleinputmethodinWindows,thuswerealizetheSunPinyinintheWindows.ThelastpartistoanalysisthehistoricalrecordandpredicttheChinesecharacter.Thepredictionisbasedonwords.Inordertomaketheprediction,weneedfindthosewordsfromhistoricalrecord.Butthereisaproblem,therearenowordboundariesinconventionallyprintedtext.Sincethewordissuchafundamentallinguisticunit,itisnecessarytoidentifywordsinChinesetextsothathigher-levelanalysescanbeperformed.Inthisproject,wechooseMMSEGGasthealgorithmtoidentifywords.Maximummatchingcantakemanyforms.Oneissimplemaximummatching,whichisthebasicformistoresolvetheambiguityofasingleword.Theotheriscomplexmaximummatching,thisismuchmorecomplexthanthebasicformanditusesfourrulestoresolvetheambiguities.Inthealgorithm,weusesimplemaximummatching,sothereexistssomeambiguities.Forthepurposetoresolvethem,thestatisticalmodelisused.Whensomecharacterscanbeaword,theprobabilityofthosecharactersstaytogetherisgreat.TocombinetheMMSEGGandstatisticalmodel,aquietwellwordidentificationsystemforChinesetextiscreated.Thenwemakeprediction,forthosewords,welistthembythetimetheyinput.Theuserinputsomepinyincharacters,wecomparethemwiththeword’spinyininthehistoricalwordlist,findthematchone.Addthiswordtothecandidate,thusgoalofanalysisthehistori

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论