Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fkxxyz committed Jun 13, 2020
0 parents commit 60abe56
Show file tree
Hide file tree
Showing 9 changed files with 1,027 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cache/
data/
165 changes: 165 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.


This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.

0. Additional Definitions.

As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.

"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.

An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.

A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".

The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.

The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.

1. Exception to Section 3 of the GNU GPL.

You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.

2. Conveying Modified Versions.

If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:

a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or

b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.

3. Object Code Incorporating Material from Library Header Files.

The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:

a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the object code with a copy of the GNU GPL and this license
document.

4. Combined Works.

You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:

a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.

c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.

d) Do one of the following:

0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.

1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.

e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)

5. Combined Libraries.

You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:

a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.

b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.

6. Revised Versions of the GNU Lesser General Public License.

The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.

If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# 🍀️四叶草拼音输入方案

## 简介

在linux端,很多拼音输入法有少许bug和卡顿,或功能不全,所以接触了 [rime](https://rime.im) ,然而自带的[朙月拼音](https://github.com/rime/rime-luna-pinyin)[袖珍簡化字拼音](https://github.com/rime/rime-pinyin-simp)均不是很不是很理想,但是探索过程中发现很多很好的开源项目提供词库,那么我为什么不综合这些开源项目的优点基于 rime 制作出一个词库和配置呢。

## 定制描述

特色以及描述如下:

1. 自己做词库,包含词频信息,各个词库分开存放。

-[pypinyin](https://github.com/mozillazg/python-pinyin) 项目生成所有字词的拼音
- 参考[结巴中文分词](https://github.com/fxsjy/jieba)项目、[rime八股文](https://github.com/rime/rime-essay)[袖珍簡化字拼音](https://github.com/rime/rime-pinyin-simp)的字的字频

- 由百度搜索到某个人基于大数据做过的[360万中文词库+词性+词频](https://download.csdn.net/download/xmp3x/8621683)

- 自带[清华大学开源词库](https://github.com/thunlp/THUOCL)

2. 加入 [emoji](https://github.com/rime/rime-emoji) 支持

3. 支持繁简切换,用 [opencc](https://github.com/BYVoid/OpenCC) 从简体切换为繁体

4. 让符号的输入符合搜狗拼音的习惯

5. 部分符号能够通过拼音输入,如 ²

[rime-symbols](https://github.com/fkxxyz/rime-symbols) 该模块与此项目独立,你可以把这个模块放到别的输入法上用。

6. 实现一个词库设置工具,能够实现打patch,设置模糊音,导入词库等。

(暂未实现)

如果你想了解此项目词库的具体生成过程,请来这两个地方: [clover-dict-gen](https://github.com/fkxxyz/clover-dict-gen)[thuocl2rime](https://github.com/fkxxyz/thuocl2rime)

## 开始使用

由于 rime 是跨平台的,因此🍀️四叶草简体拼音也能在各个平台使用,所以请先参考 https://rime.im/download/ 安装好 rime 引擎,然后在 [releases](https://github.com/fkxxyz/rime-cloverpinyin/releases) 界面下载最新版本的 **clover.schema-版本号.zip****clover.schema-build-版本号.zip** ,解压到[用户资料目录](https://github.com/rime/home/wiki/RimeWithSchemata#rime-%E4%B8%AD%E7%9A%84%E6%95%B8%E6%93%9A%E6%96%87%E4%BB%B6%E5%88%86%E4%BD%88%E5%8F%8A%E4%BD%9C%E7%94%A8)

然后修改配置目录的 default.custom.yaml ,将此输入法加入列表(小狼毫可以直接点右下角右键,输入法设定可以直接勾选)

```shell
patch:
schema_list/schema: clover
```

然后,切换到 rime 输入法,打开菜单点击重新部署即可(一般会自动重新部署),由于词库量大,第一次部署需要一定的时间耐心等待即可。

提示:默认按 F4 打开方案选单,再按 2,可以繁简切换、emoji开关、特殊符号开关、全角半角切换。

最后,有什么建议想法或者需要什么帮助,欢迎在 [issues](https://github.com/fkxxyz/rime-cloverpinyin/issues) 提出。

## 关于构建

该仓库的内容只包含构建四叶草输入法方案的脚本,如果想要自己构建,需要以下环境

操作系统: linux

python版本: 3

python依赖的库: [jieba](https://github.com/fxsjy/jieba)[pypinyin](https://github.com/mozillazg/python-pinyin)[opencc](https://github.com/BYVoid/OpenCC)

下载工具(三者任意一个均可): [aria2](http://aria2.sourceforge.net/)[wget](https://www.gnu.org/software/wget/wget.html)[curl](https://curl.haxx.se/)

解压工具(三者任意一个均可): [unzip](https://www.info-zip.org/UnZip.html)[bsdtar](https://libarchive.org/)[7z](http://p7zip.sourceforge.net/)

rime基础库: [librime](https://github.com/rime/librime)

克隆此仓库,然后直接执行构建即可

```shell
./build
```

完成后,会生成 cache 目录和 data 目录

- data 是最终生成的目录
- cache 是生成过程中下载和生成的中间文件



其中,执行 build 时,可以有个参数

```shell
./build [minfreq]
```

minfreq 代表360万词里面指定的最小词频,频率低于该值的词语会被筛选掉,达到精简词库的目的,默认是100,该值越小,最终生成的词库越大,为 0 表示不精简词库(会生成大约 100 兆左右的词库)。

Loading

0 comments on commit 60abe56

Please sign in to comment.