Skip to main content

手写汉字识别库 (Digital Ink Kit)

Project description

dinkit

Digital Ink Kit — 手写汉字识别库。

安装

pip install dinkit

快速开始

from dinkit import recognize

strokes = [
    [[312, 211], [312, 215], ...],  # 第一笔
    [[382, 363], [401, 358], ...],  # 第二笔
    # ...
]

result = recognize(strokes)
print(result)
# {'我': 3049, '找': 3784, '戌': 4144, ...}

笔迹格式:每个子列表代表一笔,内含 [x, y] 坐标点。

连续识别

如需多次识别,使用 Recognizer 复用引擎实例:

from dinkit import Recognizer

with Recognizer() as reco:
    result1 = reco.recognize(strokes1)
    result2 = reco.recognize(strokes2)

项目结构

dinkit/
├── dinkit/           # Python 包
│   ├── __init__.py   # recognize() 入口
│   ├── recognizer.py # Recognizer 类
│   ├── _native.py    # ctypes 原生绑定
│   └── lib/          # 平台动态库 (.so / .dll / .dylib)
├── native/           # C/C++ 识别引擎源码
├── tests/            # 测试
└── project/qt/       # Qt 手写识别演示程序

开发环境

在项目根目录安装可编辑包(IDE 调试和测试需要先执行此步骤):

pip install -e .

运行测试:

pytest tests/
# 或
python tests/test_recognize.py

若尚未编译原生库,需先构建并复制到 Python 包:

mkdir -p build && cd build && cmake .. && cmake --build .
cp libdinkit.* ../dinkit/lib/

从源码构建原生库

mkdir build && cd build
cmake ..
make
cp libdinkit.* ../dinkit/lib/   # 复制到 Python 包

Qt 演示程序(汉字守卫战)

手写汉字闯关游戏:按提示写字,根据识别候选排名计分,完成后查看总成绩。

mkdir -p build && cd build
cmake .. -DBUILD_QT_DEMO=ON
cmake --build .
./project/qt/dinkit_demo

详见 project/qt/README.md

向后兼容

旧版 API 仍可使用:

from dinkit import Recognize

reco = Recognize()
result = reco.Single(strokes)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dinkit-1.1.2.tar.gz (1.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dinkit-1.1.2-py3-none-any.whl (1.6 MB view details)

Uploaded Python 3

dinkit-1.1.2-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86-64

dinkit-1.1.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

dinkit-1.1.2-cp313-cp313-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

dinkit-1.1.2-cp312-cp312-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12Windows x86-64

dinkit-1.1.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

dinkit-1.1.2-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

dinkit-1.1.2-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11Windows x86-64

dinkit-1.1.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

dinkit-1.1.2-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dinkit-1.1.2-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10Windows x86-64

dinkit-1.1.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

dinkit-1.1.2-cp310-cp310-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

dinkit-1.1.2-cp39-cp39-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9Windows x86-64

dinkit-1.1.2-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

dinkit-1.1.2-cp39-cp39-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file dinkit-1.1.2.tar.gz.

File metadata

  • Download URL: dinkit-1.1.2.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for dinkit-1.1.2.tar.gz
Algorithm Hash digest
SHA256 5adc86de0d38e6e97e1f1caf225dbed1790feb2ae5cd5c8369ff0dc0b1427eaa
MD5 1f8665c5bcbf797d569870dfd7dd9ea5
BLAKE2b-256 84a061f82a3e309ede717ee2822d80cd73bd7ff10b8f2b2d7946f5aa7f40a196

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: dinkit-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for dinkit-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 18ac06d24864aac8fce95163fbf1ea25d1646f0ddc33394438754dcff9f129bd
MD5 94782a9d19e52318b9ca5ac3ede53ef5
BLAKE2b-256 33f7a1510fac9b8bc1b0f1bf6b35ed31e59c5a17c26443dc584017eb3ec87e71

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: dinkit-1.1.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dinkit-1.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0b0a1a3d957372f62b211c91531b2ca944b61fa904c1253b3c8e87c24e1c8852
MD5 e1fec87f2560b31166f414d2ab2d7fdb
BLAKE2b-256 ac180f6fbfb308b5a19dd13d0e45d59b3caa2fee8ef525d56564df7954d98ab8

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dinkit-1.1.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dd3fc9854c54fa469fc3ce3de1fabb0b6184ffd42dd72c7dda91d25b2fdecb82
MD5 95398f8e7e8195ba083824398beccad2
BLAKE2b-256 19c0cbcc747fa6b1baf62a3f1bfa9f788da723cc5fa2e05fc93cced507b3292a

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dinkit-1.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc713ac4cd318a871aaad942778ef6d201926f925d9111ddba185169d75e051d
MD5 0591d2014052d51961eb3a32f492b019
BLAKE2b-256 af732c428da1935386add7d710cab670e02f3945fad3185c62a9766bacd2b202

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: dinkit-1.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dinkit-1.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d1dbd4c2248ee820eb5ae31ea43f319f6c214d072eae3cfad2fd80c6ac16d2f5
MD5 2af33658d18ca96793aa6bb65b439fdd
BLAKE2b-256 7e32ec9dc435d0fd8974e4e5af30e1e88be9abe85fed319f914229fd18acd3d7

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dinkit-1.1.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0aa5570500c2fec2899d97181590a6e3f86936e8c430897d31e223cb5fcba96f
MD5 6d951dd79b7a952fedddfba81e3c834a
BLAKE2b-256 71867374261ca1b357361590dedbc0a4604b0e7440e4aeaf38afb613821a2e60

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dinkit-1.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9df7756167575352bd91e38da356cd33752f2f235e9c4b85949f775702cf5e59
MD5 933b5b020d35c025a34e8820fd659546
BLAKE2b-256 6b835e078e6abf9f21fc4a236a4002f8ec7a82efba34735f99e19ad1f61088f5

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: dinkit-1.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dinkit-1.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8e95961ede3e6ef69854811afe42d09daaf936688c767754523e41d11939e729
MD5 3f9d2b10866f0d3fd6671ee8e1a76968
BLAKE2b-256 3e92331c8a059accc5552832f108a992325d26e9db874792270ebbe80bcef0ff

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dinkit-1.1.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4970c721c70723d2251d0d03f0469b1e6fb2a4db1d85f8c9d4b4b539516160d2
MD5 f2756e8e85390566cba794ed2d7334c9
BLAKE2b-256 dc439964f013e8aa7b0d89f4bb851297ee58a80d04b11e33223edad2c7c264fa

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dinkit-1.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0744c3d941eec6aa4affa7848285f66c0247e2734760daf2c30e05dd0d61b9d2
MD5 6d5ef2d237eb0fa3c48d70cd1b1abd4c
BLAKE2b-256 1e1355f7726e16ee7a9dc15212eed260f62c9232af9ec86f2f1386647e9aee13

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: dinkit-1.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dinkit-1.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 320b917acb9c6ce2f0d0df6e5e6ed959024e41fedfad4458bd0edec7d51c29cc
MD5 f9e3a1dc4db3375194c0cde9e765f8e1
BLAKE2b-256 d9c1b7c599a57015a5b970e816e59f8bc693f4255cb1f0843b9c2fab77a34e3a

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dinkit-1.1.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8842087406c341e39160325063b589419c668cad3ec38cf86b1e97eec0ceb7b1
MD5 4d89035240ac6405b347fe9655ce19eb
BLAKE2b-256 6c78179b64ec58a5db265002c247f30fc43aa7155d711dd6c5919b26236b8b29

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dinkit-1.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ba85bf75440db92b19a902fbbc2f9783c81795fec7d7fa49a5a600e64fd47de
MD5 c1f86122b12c1c80f842b6a6dbdb9730
BLAKE2b-256 207bb03530b8f851d607c36b6385e4de72008118236565d3e66d1263768a4d5a

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: dinkit-1.1.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dinkit-1.1.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0dc6bbb51174c97849d2adc33920281e5dbb84dc5bf7e71e644082b6b54c6799
MD5 54ae9fcdcce92f4fa91f3878220fa215
BLAKE2b-256 1b818ab256af6473266832f7637feb14f52e4e19835ec7a4c23c873d33a82ada

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dinkit-1.1.2-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fba8710c2281f77bbacb3d01d2ce967a3cc32dfba82e434d1d533166ca5bcf3a
MD5 069a8f36e4bec452de7a916d8ce5acd5
BLAKE2b-256 e6feb8a3e19d1ec54e0d7c76cfced37c134af3b3e9e7ddf394cdefc8c4b0ffb3

See more details on using hashes here.

File details

Details for the file dinkit-1.1.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dinkit-1.1.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b50ec71acc46813acd776b2a0ca9739c9825351b6454cefc0e76852e632dad00
MD5 608e4c7fef6e787558e294f4dad0c53c
BLAKE2b-256 255f2eb1f611dc29a67b41c4e92d16a821e581fbfb262ad938d2d91a21424a8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page