Skip to main content

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

Project description

dinkit

Digital Ink Kit — 轻量级手写汉字识别库,纯 C 实现,毫秒级响应。

PyPI version Python Platform

安装

pip install dinkit

支持 Python 3.9+,覆盖 macOS (Apple Silicon)、Linux (x86_64)、Windows (x86_64)。

快速开始

单次识别

from dinkit import recognize

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

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

连续识别

多次调用时用 Recognizer 复用引擎实例,避免重复初始化:

from dinkit import Recognizer

with Recognizer() as reco:
    for strokes in batch:
        result = reco.recognize(strokes)
        print(result)

笔迹格式

strokes: List[List[Tuple[int, int]]]
  • 外层列表:一笔一画
  • 内层列表:该笔包含的 [x, y] 坐标点序列

API 参考

recognize(strokes, top_k=10) -> Dict[str, int]

一次性调用,适合零散识别场景。

参数 类型 说明
strokes List[List[Tuple[int, int]]] 笔迹坐标
top_k int 返回候选数量,默认 10

返回 {汉字: 置信度} 字典,置信度越低越好(本质是匹配距离)。

Recognizer (类)

可复用的识别器,适合批量识别。

  • recognize(strokes, top_k=10) — 识别笔迹,参数同上
  • 支持 with Recognizer() as reco: 上下文管理器,自动释放资源

许可证

MIT

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

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

Uploaded CPython 3.13Windows x86-64

dinkit-1.3.1-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.3.1-cp313-cp313-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

dinkit-1.3.1-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.3.1-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

dinkit-1.3.1-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.3.1-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

dinkit-1.3.1-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.3.1-cp310-cp310-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

dinkit-1.3.1-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.3.1-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.3.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: dinkit-1.3.1-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.3.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3432c66d87d5484a84574d1e3f11badd446b4b55f1b5b20db02fa99b44227110
MD5 f766c84fd8847a44123a39bc9427b232
BLAKE2b-256 28e7e6335ba4032cf1c47a9adab270cbc2c7ca5815577897d2753c71cbf23095

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dinkit-1.3.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 30c67f1b8a8d71011c0e6a7a30ade2ba0c31de3911a3a6927eae8c8e988b56a4
MD5 f8ab5090b4548c250edf6c135e9f17c9
BLAKE2b-256 acf0402e69e08ca94b784c460605bf1c9a6f33a38d2570e0b5a1d8788647d5d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dinkit-1.3.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c7b0767bd5b6bd111ff113063cea944a18b3525f93e3d74a043781f1d75b8973
MD5 a4a91ce233b6baaf78bc0b25c9e0b336
BLAKE2b-256 7fe8da794ee1aead9f1594d2c86ae48cf4925a2f3a72b1e63edc870f7466621d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dinkit-1.3.1-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.3.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 646f96401398ce8b3b3332de6d23db8acf1ab24c7bf9947f0196883841807db5
MD5 9d9a65f9bc68df41afa319bc3422537a
BLAKE2b-256 02e1e92d4f268e620d0096ee44bfa5820b70d36a3ad76d20625958e9a57c465e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dinkit-1.3.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f3a1675b13100415dda8992aa1028344c12696a73c01d480a9dd4ef08da9e7d2
MD5 20bd7c8fb6f9a0e7856f1cfc74ccdd23
BLAKE2b-256 5526952d5a760611b84872dcdb355795122a6adcab90933d6275441856e1a8b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dinkit-1.3.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c3361b3f6cd9d9725635a1fde599afe80d9831f6e93cd01b6cf294d7f104cc8c
MD5 ff30648f51c2c49fa3292fc971eafbda
BLAKE2b-256 b66b12000a2017c5039c13a9dca40fccfd77c64580611d372d72a213c9c7d9bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dinkit-1.3.1-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.3.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f0598162b2891c4e9e91fd26b79fc2e7d404ea584e84e5e9e0ee01f03d1928a9
MD5 4e4a74cbcb5ae5bb934180760dfda084
BLAKE2b-256 cc3407e928782523b6be264d048ac01313a0bf0f10d90fd092c595924a48612c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dinkit-1.3.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dff6fd32ef33dcd4767c565bbb5f379fc9f98201278e9d85e39ad7f10dd18c15
MD5 0a39e85b801ad394a56a73ead6c1fc13
BLAKE2b-256 61d8bc04c82996605cf2df6b026370395f5bb3c0774b23d73ccc5f2ccacc63fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dinkit-1.3.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86b3c5c30c9e5ac5ef658bf58e067f699147495e9dabfd366fa613fd7e73d639
MD5 43406f9c4cd9740a26dcd2cb9927cfa4
BLAKE2b-256 f181f7fab1547f94435d7c73bfb731f8fcdc0db0d5907875f98255ed80f4e689

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dinkit-1.3.1-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.3.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d76df8344f0ff5bf500d3f6143f8baa6c71ce7c3eb4ad50b22fca3af7e55c0a2
MD5 2bf73f73616c5bd3c0aefd9637788394
BLAKE2b-256 8ce315c2f4901cdf9f0b360e2e178063ee7749e5458e609e3f908aafd5c4786e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dinkit-1.3.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9f24e11df725de18a1cdfcfea94ac9d7cf422f2e568f866191ce60d6615c2878
MD5 4ea94336c3d685c297caaf619b7eda8b
BLAKE2b-256 efe9f55aca55834dc17023439ed0173c72532644d5ffa954fa2b798a307a4448

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dinkit-1.3.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d292185ff90a6d9391baf0f8cf19c6b58410de6726edf5f91e34f2d8105b4981
MD5 047f836d219608a3e46597e94751580a
BLAKE2b-256 fd8a6fced1ae7e93b8277e04511809cf31ab7fb30a907d2efde5dc3dfb1bb719

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dinkit-1.3.1-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.3.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8339191642a8502afae0f49a982a1140cf138d48ffead7cb97f4520b63eb1b69
MD5 190205d61b32278945b0ccb661fb9452
BLAKE2b-256 d99fd271f7ea76063b0d8c9b8d150bbf726b4a59cb6d313c0b2caa4c0977c652

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dinkit-1.3.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5e91874a3504c68c3c025f045e080bb1c95f94977f75706e3151d99e80bdf8cb
MD5 5179d6dd52480ecd04004befd7c17601
BLAKE2b-256 142d3a635e29513e5afaff90e2f2c068f5b174c4ddbfb886fc971641410b4b5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dinkit-1.3.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b627017a88b2d4879c66e1069c8d06f280c7fd7012648cc6702a2e8267ce978a
MD5 629827f1535bd31659876cb6273f1da9
BLAKE2b-256 de5942779537019e3ec6806bed172560a016e1259605773fa06dc3899cac95cd

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