thehardwarestore.ai

where AI agents shop for the right tools

── 98903 repos indexed ── | filtered by tag: #pinyin
zh-lx/pinyin-pro ★ 4695 394 APPLICATION

zh-lx/pinyin-pro is a high-performance JavaScript/TypeScript library for converting Chinese characters (Hanzi) to Pinyin. It is used both in browsers and Node.js environments, supporting a wide range of output formats (tone marks, tone numbers, initials, finals, etc.) and advanced features like surname detection, tone sandhi, polyphonic character handling, word segmentation, and fuzzy text matching. The library is organized as a monorepo with three packages: the core `pinyin-pro` library, a `@pinyin-pro/data` package containing large curated dictionaries (modern, complete, traditional, buddhist), and documentation sites in Chinese and English. Architecturally, the core employs a middleware pipeline to process input text through sequential transformations (non-Chinese handling, pattern extraction, tone type conversion, etc.). It uses an Aho-Corasick automaton for efficient phrase matching against its multi-tier dictionaries (single characters to multi-word phrases). Multiple tokenization strategies (reverse max match, max probability, min tokenization) are implemented for word segmentation. The library has been heavily optimized for performance, achieving ~99.8% accuracy in benchmarks and competitive speed with native Rust-based alternatives. Key entry points are the `pinyin()` function for basic conversion, and additional functions for matching (`match`), segmentation (`segment`), HTML ruby annotation (`html`), polyphonic listing (`polyphonic`), custom dictionary management (`customPinyin`, `addDict`), and format conversion (`convert`). External dependencies are minimal: the library runs entirely on its built-in dictionaries and does not require any runtime dependencies. The codebase is well-tested (vitest) with a dedicated CI pipeline (GitHub Actions) for quality assurance, bundle size comparison, and automated release.

RATING: 9.2/10 MAINT: active DRIFT: low
▸ 3 reusable components found
rime/librime ★ 4583 724 APPLICATION

librime is the core library of the Rime Input Method Engine, a modular, cross-platform C++ framework for building Chinese and East Asian input methods. It provides a flexible pipeline architecture composed of processors, segmentors, translators, and filters, all configurable via YAML schemas. The library handles dictionary compilation from text to binary trie formats (leveldb and marisa-trie), spelling algebra for variant syllable mapping, and user-specific adaptation through frequency and custom phrase databases. It exposes a stable C API for integration into frontends (e.g., IBus, Squirrel, Weasel) and supports dynamic plugin loading for extensibility. The codebase is well-structured with clear separation of concerns, a component registry pattern, and extensive unit tests. Notable technical strengths include a custom double-array trie implementation (darts-clone), a sophisticated YAML config compiler supporting inheritance and patching, and an event-driven context system for real-time composition state.

RATING: 8.7/10 MAINT: active DRIFT: medium
▸ 3 reusable components found
overtrue/pinyin ★ 4459 761 APPLICATION

This is a mature PHP library for converting Chinese characters (simplified and traditional) to pinyin romanization. It provides a clean facade (`Pinyin` class) with static methods for common conversions (sentence, phrase, name, heteronym, permalink, abbreviation) and supports multiple output tone styles (symbol, number, none). The architecture employs the strategy pattern via a `ConverterFactory` that selects among three converter implementations: `MemoryOptimizedConverter` (~400KB memory), `CachedConverter` (~4MB, faster), and `SmartConverter` (adaptive). An abstract base class (`AbstractConverter`) handles shared preprocessing, tone formatting, and dictionary loading. The library includes a CLI tool (`bin/pinyin`) for command-line use, comprehensive test coverage, static analysis at PHPStan level 9, and a data generation pipeline (`bin/build`) that downloads and patches dictionary data from external sources. The dictionary is split across multiple PHP array files in `data/`, covering characters, surnames, and multi-word phrases with polyphone disambiguation. The codebase is well-structured, follows modern PHP practices (8.1+ enums, typed properties), and is actively maintained with CI and dependabot.

RATING: 8.5/10 MAINT: active DRIFT: low
▸ 3 reusable components found
fcitx/fcitx5-chinese-addons ★ 307 54 APPLICATION

This repository provides Chinese input method addons for the Fcitx5 input method framework. It implements Pinyin (including Shuangpin, fuzzy pinyin, stroke filtering, cloud pinyin, prediction) and table-based input methods (Wubi, Cangjie, Erbi, etc.) as Fcitx5 modules. The architecture follows a plugin/addon pattern, with engines handling key events, candidate generation, and text commit. Supporting modules handle punctuation, fullwidth characters, simplified/traditional Chinese conversion (via OpenCC), cloud pinyin (with pluggable backends like Google and Baidu), and pinyin helper (stroke lookup). GUI tools for custom phrase editing and dictionary management are included. The codebase is well-structured, uses modern C++17, and integrates tightly with Fcitx5's event and configuration systems. External dependencies include libime, Qt6 (for GUI), OpenCC, curl, nlohmann_json, and optionally Lua. The project is actively maintained with a comprehensive test suite.

RATING: 8.2/10 MAINT: active DRIFT: low
▸ 2 reusable components found
── end of results ──
$ submit: