二号机
Blogroll
Links
Search
Recent Comments
- csslayer on How to make your application support Input method under Linux
- Sławomir Lach on How to make your application support Input method under Linux
- Links 06/01/2023: GNOME 44 Schedule is Ready | Techrights on How to make your application support Input method under Linux
- jack on Unlimited Code Works
- Firo on Use multiple input method in different window.
Tags
acfun amarok android archlinux ati blogbus c++ cmake dbus fcitx fcitx4 fcitx5 fedora feeling git gnome gtk ibus icecast input method KDE kde4 kde4.5 keyboard layout kimpanel kwin libime Linux mpd nginx opensource opensuse planetkde plasma qt sunpinyin ubuntu vim wayland Wordpress x11 个人Linux唠叨 做饭 歌词 追漫笔记Categories
Archives
Tag Archives: libime
libime 原理介绍(二)
之前第一篇主要介绍了关于 beam search 和输入切分相关的内容,以及提供的一些基础数据结构。接下来主要着重补全介绍上次没有提及的 UserLanguageModel 和 HistoryBigram 的实现细节。 声明,本文需要的很多前置知识都可以在大学本科的自然语言处理类课程找到,关键词「统计语言模型」,「N-gram」。概括的说,N-gram模型是对现实语言的不精确概括,它不关心语法,只关心词与词之间出现的频率,尽管不精确,但对于输入法,机器翻译,语音识别等等领域都有不错的效果。 首先上一篇当中提到了我们的输入法的算法核心是 N-gram 和 beam search。一般对采用这种算法的输入法来说,N会取 3 或者 2。可以取得效果和内存占用的平衡。这里姑且来说我们也继承了一部分 Sunpinyin 的精神,因为最初最初的数据就是采用 Sunpinyin 使用的 Open-Gram。当然这里顺便一提,在最新的版本我们重新用全新的数据训练了语言模型。但依然采用了和 Sunpinyin 一样的 Trigram。 HistoryBigram,顾名思义,是一个存储用户输入的 Bigram。它干的事情其实非常之简单,就是把用户的输入的句子根据词一条一条的储存起来。而在内存中,它被存储在 DATrie 中。你也许想问一个问题,就是 DATrie 抽象起来看,可以被看作一个字符串到 4 byte 数据的映射,那么它究竟是怎么存储 Bigarm 这样有两个级别的 Key 的映射表呢? 答案其实很简单,就是你把 Key … Continue reading
A new pinyin input method that might be slightly better than sunpinyin
What do I mean when I say “slightly better”? First of all, thanks to sunpinyin’s open-gram, I can use its data for free. So, on the pinyin side, libime IS using the exact same data from sunpinyin. So what’s the … Continue reading