# openharmony_inputmethod **Repository Path**: FBFBFB/openharmony_inputmethod ## Basic Information - **Project Name**: openharmony_inputmethod - **Description**: No description available - **Primary Language**: Unknown - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-11-27 - **Last Updated**: 2026-12-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ohos_inputmethod > 一款面向 OpenHarmony / HarmonyOS 标准系统的轻量开源输入法,纯本地离线运行,支持 26 键全拼、八种双拼、九键(T9)拼音、英文整句联想与单字手写输入,并提供多套主题、剪贴板历史、符号与表情面板等日常功能。 基于 OpenHarmony [inputMethodEngine](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-ime-kit/js-apis-inputmethodengine.md) 与开源输入引擎 [librime](https://github.com/rime/librime)(中州韵),词库基于[万象拼音 rime-wanxiang](https://github.com/amzxyz/rime-wanxiang)。 ## 功能特性 - **26 键全拼与八种双拼**:支持全拼及小鹤 / 自然码 / 微软 / 搜狗 / 智能ABC / 紫光 / 国标 / 万象双拼,支持整句输入与一键繁简切换,切换即时生效 - **九键(T9)拼音**:支持整句输入与手动分词、multi-tap 英文及可滑动标点柱 - **单字手写输入**:正方形画布书写,抬笔即出多候选点选上屏,支持双指轻点删字,右侧提供常用标点 - **英文联想输入**:英文 26 键支持单词与词组联想,空格智能上屏 - **候选与连续联想**:候选条支持左右滑动浏览全量候选与展开宫格选词,支持上屏后中文连续联想 - **按键与外设体验**:26 键字母支持长按选择小写 / 角标符号或数字 / 大写变体,多指触控防丢字,并支持外接物理键盘选词 - **常用面板**:符号面板(多分类、最近符号持久化)、表情面板、剪贴板历史(点选粘贴、支持清空) - **个性化设置**:五套主题配色、多种按键音效,设置自动持久化 ## 界面预览 | 26 键拼音 | 九键拼音 | 英文联想 | 单字手写 | 表情面板 | | :---: | :---: | :---: | :---: | :---: | | ![26键拼音](screenshots/pinyin_26.jpg) | ![九键拼音](screenshots/pinyin_t9.jpg) | ![英文联想](screenshots/english.jpg) | ![单字手写](screenshots/handwriting.jpg) | ![表情面板](screenshots/emoji.jpg) | ## 构建环境 | 项 | 要求 | |---|---| | IDE | DevEco Studio 6.1 及以上 | | SDK | OpenHarmony **Full SDK**(本项目使用系统级 `inputMethodEngine` 接口,需按[官方指南](https://docs.openharmony.cn/pages/v3.2/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md/)将标准 SDK 替换为 Full SDK) | | 版本 | compileSdkVersion 23 / compatibleSdkVersion 20(OpenHarmony 6.0 · API 20) | | native 依赖 | librime 及其依赖已以静态库形式内置(`entry/src/main/cpp/rime_build/`),直接构建即可,**无需交叉编译环境** | 构建:在 DevEco Studio 中 `Build > Build HAP(s)/APP(s)`;或在项目根目录执行(需自行配置签名): ```bash hvigorw assembleHap --mode module -p product=default -p buildMode=debug --no-daemon ``` ## 安装与启用 ```bash hdc install ./entry/build/default/outputs/default/entry-default-signed.hap # 拉起输入法切换弹窗,选择本输入法 hdc shell aa start ability -a InputMethod -b cn.openharmony.inputmethodchoosedialog ``` 如安装报 `install sign info inconsistent`,先 `hdc uninstall <已装的包名>` 再重新安装。 ## 工程结构 ``` ohos_inputmethod ├── AppScope/ # 应用级配置 ├── entry/src/main/ │ ├── ets/ # ArkTS 层 │ │ ├── model/KeyboardController.ets # 键盘控制与 librime 生命周期 │ │ ├── model/PinYinService.ts # NAPI 封装(唯一入口) │ │ ├── model/HandwritingService.ts # 手写识别服务(模型下发 + NAPI 调用) │ │ ├── common/worker.ts # 按键驱动 worker │ │ ├── components/ # 键盘/面板自定义组件 │ │ └── ServiceExtAbility/ # InputMethodExtensionAbility │ ├── cpp/ │ │ ├── ime_rime.cpp # librime 的 NAPI 封装 │ │ ├── handwriting_napi.cpp # 手写识别的 NAPI 封装 │ │ ├── preprocess.c / include/preprocess.h # 手写轨迹预处理 │ │ ├── ncnn/ # 推理引擎静态库与头文件(预编译内置) │ │ ├── rime_build/ # librime 及依赖的静态库(预编译内置) │ │ └── CMakeLists.txt │ └── resources/rawfile/ │ ├── rime/ # 输入方案与词库 │ │ └── prebuilt/ # 预编译词库产物(首装免部署) │ └── handwriting/ # 手写识别模型与字符表 ``` ## 许可与致谢 本项目基于 **GNU 通用公共许可证第 3 版(GPL-3.0-or-later)** 发布(见 [LICENSE](./LICENSE))。 Copyright (C) 2026 fbf (740973613@qq.com) 本项目在 OpenHarmony 官方样例 [applications_app_samples](https://gitee.com/openharmony/applications_app_samples) 之 kikaInput(Apache-2.0)基础上修改开发:替换输入后端为 librime、新增九键/双拼/面板等功能,与上游存在大量差异。 以下第三方组件与资源**保持各自原始许可**,随本项目一并分发(GPLv3 允许并入时保留原许可的归属等附加要求),版权归各自作者所有: | 组件 / 资源 | 许可证 | 使用方式与位置 | |---|---|---| | [librime](https://github.com/rime/librime) 1.13.0 | [BSD-3-Clause](https://github.com/rime/librime/blob/master/LICENSE) | 静态链接(`entry/src/main/cpp/rime_build/`) | | [Boost](https://www.boost.org/)(regex) | [BSL-1.0](https://www.boost.org/users/license.html) | 静态链接 | | [leveldb](https://github.com/google/leveldb) | [BSD-3-Clause](https://github.com/google/leveldb/blob/main/LICENSE) | 静态链接(用户词库存储) | | [yaml-cpp](https://github.com/jbeder/yaml-cpp) | [MIT](https://github.com/jbeder/yaml-cpp/blob/master/LICENSE) | 静态链接(方案解析) | | [marisa-trie](https://github.com/s-yata/marisa-trie) | [BSD-2-Clause 或 LGPL-2.1+](https://github.com/s-yata/marisa-trie/blob/master/COPYING.md) 双许可 | 按 **BSD-2-Clause** 使用,静态链接 | | [OpenCC](https://github.com/BYVoid/OpenCC) | [Apache-2.0](https://github.com/BYVoid/OpenCC/blob/master/LICENSE) | 静态链接,繁简转换数据随包分发 | | [万象拼音 rime-wanxiang](https://github.com/amzxyz/rime-wanxiang) v18.2.1 | [CC BY 4.0](https://github.com/amzxyz/rime-wanxiang/blob/wanxiang/LICENSE) | 词库/方案/lua 脚本(`rawfile/rime/wanxiang/`),本仓库对其有裁剪与修改,不代表上游官方立场 | | [ncnn](https://github.com/Tencent/ncnn) | [BSD-3-Clause](https://github.com/Tencent/ncnn/blob/master/LICENSE.txt) | 静态链接(手写识别推理,`entry/src/main/cpp/ncnn/`) | | [Handwritten](https://github.com/Ismantic/Handwritten)(手写模型与预处理) | [Apache-2.0](https://github.com/Ismantic/Handwritten/blob/main/LICENSE) | 手写识别模型(`rawfile/handwriting/`)与预处理移植(`cpp/preprocess.c`) | | OpenHarmony applications_app_samples(kikaInput) | Apache-2.0 | 基线代码(ArkTS UI 框架与输入法接入层) | ## 支持作者 如果这个项目对你有帮助,欢迎请作者喝杯咖啡 ☕

微信收款码