文档介绍:
基于 trie 树的中文拼音输入法的研究与实现
雷宇*
(北京邮电大学网络与交换技术国家重点实验室)
5
10
15
20
25
30
35
40
45
摘要:中文输入法是指为了将汉字输入计算机或手机等电子设备而采用的编码方法,是中文
信息处理的重要技术,是电脑中的必备软件。在 PC 平台上输入法的设计可以不考虑系统资
源因素但是在一些系统资源比较少的平台比如嵌入式平台下,如何实现一个高效的输入法是
一个很重要的问题。本文就是从这个角度出发,首先研究了一种具有高查找速度和低占用空
间的数据结构 trie 树,然后将输入法和 trie 树相结合并用 MFC 来搭建图形界面框架最后实
现了一个基于 trie 树的高效的中文拼音输入法的模拟系统。用户使用时首先输入拼音,然
后根据输出的候选词进行选择或翻页操作,最后得到想要的汉字或词,从而实现输入法的功
能。
关键词:计算机应用;输入法;trie 树;拼音
中图分类号:
The research and implementation on Chinese PinYin input
method based on trie tree
Lei Yu
(State Key Laboratory working And Switching Technology, Beijing University of Posts and
munications, Beijing 100876)
Abstract: Chinese input method is an encoding method that can be used to input the Chinese
words into electronic devices such puters or mobile phones, and is an important technology
of Chinese imformation processing, a necessary software in puter. On PC platform, the
system resource factor is not needed to be considered in the design of input method, but on some
platform of low system resource such as an embedded platform it is an important problem to
realize an effective input method. From this perspective, this article first do some research in a
data structure named trie tree that has high sort speed and needs lower space, then associates input
method with trie tree and uses MFC as the graphical interface framework, finally realizes an
effective input method simulator. When you use the input method, first input the Pinyin, then
select the candidate words or do the flip operation, finally you can get the word you need, in this
way the function of input method can be experienced.
Key words: Computer application; input method; trie tree; Pinyin
0 引言
随着计算机技术的发展,输入法是用户使用电脑必不可少的内容,是每个使用者使用电
脑的第一堂课,它是人机对话的最基本途径因为中文的输入不能够通过键盘直接实现,因此
中文输入法以及配套的中文输入软件是中国电脑用户的必备工具。到现在为止,输入法已经
过渡到了第三代输入法,走向了智能化、人性化和个性化的发展阶段。现在输入法的主要目
的已经变成了通过占领用户的电脑,获取用户的信赖,让用户登录相关网站,提高网站的点
击率从而获取商业利益的一个重要工具[1]。
在 PC 机上,系统资源较为充足,输入法的实现主要考虑到的是输入法