Category Archives: fcitx development

对“fcitx5 依赖 boost 和 KDE, 探讨继续使用 fcitx4 的可行性“的回应

原贴:https://forum.suse.org.cn/t/topic/15817/7 首先,要对其中的几个所谓的错误说法进行驳斥。 1、Fcitx 5 依赖 KDE 和 Boost? 这是错误的,作为高度模块化的项目,核心库和服务器,输入法引擎,配置界面都是分离的代码库。 核心部分,反而比以前要精简得多,因为 gtk 和 qt im module 都变成了独立的项目,事实上,如果你乐意,可以编译出一个和图形库无关的 fcitx,这也是 fcitx5 能被移植到 android 上的基础。 输入法引擎部分,现在新的拼音引擎使用了极少的一部分 boost,大部分都是 header only 的,只有几个少量和 io 相关的库需要 boost 的共享库。如果你的发行版拆包精细,将只是引入约 500k 左右的依赖。 而配置界面的部分,则可能是有疑问的了,事实上它本身是在同一个代码库内分解成了两个实现,一个是只依赖于 Qt 和少量 KF5 的库,另一个则是和 KDE 系统设置集成的,也就是和 fcitx4 … Continue reading

Posted in fcitx development | Tagged , , | 4 Comments

A comprehensive guide about using Fcitx 5 on wayland

The term fragmentation is IMHO the best word to describe wayland. And that’s the reason why this page exists. While traditional “three lines” (XMODIFIERS, GTK_IM_MODULE, QT_IM_MODULE) also mostly work under wayland, but there is some other way to setup and … Continue reading

Posted in fcitx development | Leave a comment

Get event order right (Try 2!)

TL;DR: this is not considered as a user facing change. In a previous post, we discussed the issue between the input method event order and the blocking dbus call. To put it simple, input method may generate multiple different outcomes … Continue reading

Posted in fcitx development | Tagged , , | Leave a comment

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

Posted in fcitx development | Tagged , , | Leave a comment

Fcitx 5 Plasma Theme support

Kimpanel is a plasma applet that uses plasma and dbus to display the input method popup window. In X11, people who want to have native plasma theme based input method window may use it to provide a nice integration with … Continue reading

Posted in fcitx development | Tagged , , , | 1 Comment