linux 输入法框架,常用输入法框架简介 - 微信公众号:算法与编程之美 - OSCHINA - 中文开源技术交流社区...

前言

之前使用的一直都是ibus-sunpinyin中文输入法,但在使用的过程中发现很多的词组都找不到,比较麻烦,所以打算换一下ibus-googlepinyin输入法,还没用,也不知道具体的效果怎么样?不过之前windows系统中用的都是google-pinyin,一直以来都还是比较相信google的服务。本文将从一次安装ibus-googlepinyin拼音输入法的实践入手,探讨常用的输入法框架有哪些,并做一简单的介绍。

ibus-googlepinyin安装

我们先介绍如何安装基于ibus输入法框架的googlepinyin输入法。

由于google官方未提供直接的rpm或其他的直接安装方式,所以我们只能自己编译源码然后安装。由于源码使用的是cmake进行项目管理的,所以我们需要先确定系统是否已经安装cmake。

[gschen@gschen ~]$ cmake -version

cmake version 2.8.10.2

如果未安装cmake,可通过下述命令进行安装:

[gschen@gschen ~]$ sudo yum install -y cmake

接着将介绍一下具体的google拼音安装步骤:

1.安装libgooglepinyin,先获得libgooglepinyin源码,https://code.google.com/p/libgooglepinyin/downloads/list从下载列表中,下载libgooglepinyin-0.1.*.tar.bz2,接着

tar -jxvf libgooglepinyin-0.1.*.tar.bz2

mkdir build

cd build

cmake .. -DCMAKE_INSTALL_PREFIX=/usr

make

sudo make install

2. 安装ibus-googlepinyin,同样也是从步骤1中的下载列表中下载ibus-googlepinyin-0.1.*.tar.bz2,接着

tar -jxvf ibus-googlepinyin-0.1.*.tar.bz2

mkdir build

cd build

cmake .. -DCMAKE_INSTALL_PREFIX=/usr

make

sudo make install

3. 重启ibus,并在ibus preferences中添加google拼音,至此安装完成,接下来就可以使用googlepinyin了。

输入法框架

首先我们来了解一下常用的输入法框架有哪些?

scim

scim全称是Smart Common Input Method

wikipedia对它的解释是:

The Smart Common Input Method platform (SCIM) is an input method (IM) platform containing support for more than thirty languages (CJK and many European languages) for POSIX-style operating systems including Linux and BSD. It uses a clear architecture and provides a simple and powerful programming interface, which is meant to reduce the time required for developing individual IMs.

scmi是一个输入法平台,在类posix的操作系统如linux和bsd中,它支持至少30种语言。它有一个非常清晰的架构,使用了一个简单但非常强大的编程接口,该接口为我们开发自己的输入法大大的节省了时间。

fcitx

首先我们来看一下官方是如何描述fcitx的:

Fcitx [ˈfaɪtɪks] is an input method framework with extension support. Currently it supports Linux and Unix systems like freebsd. It has three built-in Input Method Engine, Pinyin, QuWei and Table-based input methods.

fcitx一个支持扩展的输入法框架。目前它支持linux和unix系统如freebsd。它有三个内置的输入法引擎,分别是拼音输入法, 区位输入法和table-based输入法。

ibus

ibus的全称是intelligent input bus

同样我们也首先来看一下wikipedia是如何描述的:

The Intelligent Input Bus (IBus, pronounced as I-Bus) is an input method (IM) framework for multilingual input in Unix-like operating systems. It's called "Bus" because it has a bus-like architecture. ibus是在类unix操作系统中是一个为了多语言输入的输入法框架,之所以叫做"bus”原因在于它是一个总线型的架构。

ibus架构

9252b287c183b3f599fe23a3e7a8d37f.png

ibus是基于c/s的架构:

他有一个ibus-daemon的后台进程,管理所有的客户端;

所有的engines,panel,config modules和IM(Input Method) clients都是ibus-daemon的客户端;

ibus是基于dbus ipc协议的。

25736633a27676aa68710fe460c8609b.png

ibus的优势在于:

ibus使用dbus rpc进行通信,客户端可以使用任何一种语言去呵ibus交互;

ibus-daemon, engines, clients&UI这些所有的都运行在独立的进程中。

结论

本文主要介绍了在linux系统中如何安装ibus-googlepinyin中文输入法,在成功安装google拼音输入法之后,并对目前常用的输入法框架做了简单的介绍。

后记

后面如果时间充裕,将会对上述提到的每一个输入法框架展开详细的介绍。

references

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值