ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

常用输入法框架简介

2021-06-29 14:02:36  阅读:409  来源: 互联网

标签:输入法 google cmake 框架 简介 ibus googlepinyin 安装


前言

之前使用的一直都是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架构

 

 <上图引用自http://2008.gnome.asia/static/upload/event_file/ibus-GNOME.pdf>

ibus是基于c/s的架构:

  • 他有一个ibus-daemon的后台进程,管理所有的客户端;
  • 所有的engines,panel,config modules和IM(Input Method) clients都是ibus-daemon的客户端;
  • ibus是基于dbus ipc协议的。

 <上图引用自http://2008.gnome.asia/static/upload/event_file/ibus-GNOME.pdf>

ibus的优势在于:

  • ibus使用dbus rpc进行通信,客户端可以使用任何一种语言去呵ibus交互;
  • ibus-daemon, engines, clients&UI这些所有的都运行在独立的进程中。

结论

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

后记

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

references

[1] http://en.wikipedia.org/wiki/Smart_Common_Input_Method

[2] https://wiki.archlinux.org/index.php/IBus

[3] http://2008.gnome.asia/static/upload/event_file/ibus-GNOME.pdf

标签:输入法,google,cmake,框架,简介,ibus,googlepinyin,安装
来源: https://blog.51cto.com/u_15281984/2953545

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有