编辑:在虚拟键盘中添加文本预测/建议 [英] Edited: Adding Text Prediction/Suggestions in Virtual Keyboard

查看:91
本文介绍了编辑:在虚拟键盘中添加文本预测/建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个屏幕虚拟键盘。我想添加一个额外的功能,即为每个单词添加文本建议,以便用户可以轻松地选择他/她想要的单词而无需键入整个单词。我想知道如何使用C#实现此功能?我在Windows窗体上开发了键盘,并希望以该窗体显示建议的单词,供用户选择。请帮忙。





P.S.我不知道这是否解释了我的问题,还是我需要在报告问题之前添加更多细节?

解决方案

你显然需要一个单词词典(字典不是类的意思)。我建议使用OpenOffice-Dictionaries(LGPL许可证):

https://wiki.openoffice.org/ wiki / Dictionaries [ ^ ]



为了能够显示建议列表顶部语言中最常出现的匹配单词,您还需要有关单词频率的数据。我知道的最好的来源是:

http:// corpora。 informatik.uni-leipzig.de/download.html [ ^ ]

(摘录自使用条件:数据的商业用途需事先获得莱比锡大学自然语言处理部门的书面同意。)



字频列表不能取代字典的原因:字源于互联网。这些列表中有相当多的非单词。我会从那里(从不同的年份和来源)下载几个列表,聚合它们然后过滤掉那些相当罕见和/或不出现在字典中的单词(你可能需要进行一些实验)。 br />


然后你必须:

- 加载这些单词及其频率计数。

- 实现一个算法尽可能快地搜索那些以用户已输入的子字符串开头的单词(参见二分搜索)。

- 按匹配单词的频率对其进行排序并显示它们以供选择

I have developed a on-screen virtual keyboard. I want to add an additional functionality of adding text suggestions with every word so that user is able to select his/her desired word easily without typing the entire word. I want to know how should I achieve this functionality using C#? I have developed my keyboard on Windows Form, and want to display suggested words in that form, for the user to select. Please help.


P.S. I don't know if this explains my problem or should I need to add more detail before my question is being reported?

解决方案

You will obviously need a dictionary of words (dictionary not in the meaning of the class). I would suggest the OpenOffice-Dictionaries (LGPL License):
https://wiki.openoffice.org/wiki/Dictionaries[^]

To be able to show those matching words that occur most often in the language at the top of the list of suggestions, you would also need data on word frequencies. The best source for this that I know of is here:
http://corpora.informatik.uni-leipzig.de/download.html[^]
(Excerpt from the Conditions of use: Commercial use of the data requires the prior written consent of the Leipzig University department for Natural Language Processing.)

The reason why the lists of word-frequencies doesn't replace the dictionary: The words stem from the internet. There are quite some non-words in these lists. I would download several lists from there (from different years and sources), aggregate them and then filter out those words that are rather infrequent and/or don't appear in the dictionary (you'll probably have to experiment a bit).

Then you would have to:
- Load these words and their frequency-count.
- Implement an algorithm that searches as quickly as possible for those words which start with the substring that the user already typed (see "binary search").
- Sort the matching words by their frequency and display them to be selected.


这篇关于编辑:在虚拟键盘中添加文本预测/建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆