# overtrue/pinyin

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/overtrue-pinyin).**

4,458 stars · 763 forks · PHP · MIT

## Links

- GitHub: https://github.com/overtrue/pinyin
- Homepage: https://github.com/overtrue/pinyin
- awesome-repositories: https://awesome-repositories.com/repository/overtrue-pinyin.md

## Topics

`php` `pinyin`

## Description

This is a dictionary-based Chinese Pinyin transliteration library used to convert Chinese characters into Pinyin with support for various tone styles and formats. It provides specialized utilities for polyphonic character resolution to manage multiple pronunciations and a generator for extracting the first letter of characters to create searchable index strings.

The library includes a formatter for converting names into Pinyin following official international travel document and passport spelling standards. It also features a tool for transforming Chinese text into hyphenated or dotted strings for use as web permalinks and URL slugs.

The project covers broad text processing capabilities including full sentence transliteration and result set management for exporting data into strings or JSON. It incorporates adaptive memory loading strategies and conversion speed optimizations to balance throughput and system memory usage.

A command-line interface is provided for converting Chinese text to Pinyin with support for text and JSON output formats.

## Tags

### Data & Databases

- [Pinyin Transliterations](https://awesome-repositories.com/f/data-databases/pinyin-transliterations.md) — Provides utilities for converting Chinese characters and full sentences into Pinyin phonetic representations. ([source](https://github.com/overtrue/pinyin/blob/master/CHANGELOG.md))
- [Character-to-Pinyin Converters](https://awesome-repositories.com/f/data-databases/pinyin-transliterations/character-to-pinyin-converters.md) — Implements a dictionary-based system to convert Chinese characters into phonetic Pinyin representations.
- [Initials Generators](https://awesome-repositories.com/f/data-databases/pinyin-transliterations/character-to-pinyin-converters/initials-generators.md) — Extracts the first letter of each character to create searchable index strings and abbreviations.
- [Pinyin Formatters](https://awesome-repositories.com/f/data-databases/pinyin-transliterations/character-to-pinyin-converters/pinyin-formatters.md) — Applies transformation patterns to convert raw Pinyin into passport standards or URL-friendly permalinks.
- [Surname-Aware Converters](https://awesome-repositories.com/f/data-databases/pinyin-transliterations/surname-aware-converters.md) — Implements specialized pronunciation rules for Chinese surnames to ensure accurate name-specific pinyin output. ([source](https://github.com/overtrue/pinyin/blob/master/README.md))
- [International Document Transliteration](https://awesome-repositories.com/f/data-databases/international-document-transliteration.md) — Adapts Pinyin spelling to meet official standards for passports and international travel documents.
- [Loading Strategy Selectors](https://awesome-repositories.com/f/data-databases/memory-optimization-strategies/loading-strategy-selectors.md) — Provides a system for selecting between optimized or cached loading strategies to balance speed and memory. ([source](https://github.com/overtrue/pinyin/blob/master/README.md))
- [Passport Standard Formatters](https://awesome-repositories.com/f/data-databases/pinyin-transliterations/character-to-pinyin-converters/passport-standard-formatters.md) — Provides a formatter that converts Chinese names into Pinyin following official international travel document spelling standards. ([source](https://github.com/overtrue/pinyin))
- [Passport Standard Formatters](https://awesome-repositories.com/f/data-databases/pinyin-transliterations/passport-standard-formatters.md) — Converts Chinese names into Pinyin following official international travel document spelling standards.
- [Initials Generators](https://awesome-repositories.com/f/data-databases/pinyin-transliterations/phonetic-pinyin-search/initials-generators.md) — Ships a generator for extracting the first letter of characters to create searchable index strings. ([source](https://github.com/overtrue/pinyin/blob/master/README.md))
- [URL Pinyin Formatters](https://awesome-repositories.com/f/data-databases/pinyin-transliterations/phonetic-pinyin-search/url-pinyin-formatters.md) — Transforms Chinese text into hyphenated or dotted Pinyin strings suitable for web permalinks.
- [Phonetic Indexing](https://awesome-repositories.com/f/data-databases/search-indexing/phonetic-indexing.md) — Generates Pinyin initials and abbreviations from Chinese text to create efficient searchable index strings.

### Business & Productivity Software

- [Polyphonic Character Handlers](https://awesome-repositories.com/f/business-productivity-software/polyphonic-character-handlers.md) — Identifies and manages multiple pronunciations for characters with more than one phonetic reading.

### User Interface & Experience

- [Phonetic Initial Extraction](https://awesome-repositories.com/f/user-interface-experience/letter-level-styling/phonetic-initial-extraction.md) — Extracts the first letter of characters to create searchable index abbreviations.

### Development Tools & Productivity

- [Pinyin Conversion CLI Tools](https://awesome-repositories.com/f/development-tools-productivity/pinyin-conversion-cli-tools.md) — Ships a command-line interface for converting Chinese text to Pinyin with text and JSON output options. ([source](https://github.com/overtrue/pinyin/blob/master/README.md))

### Operating Systems & Systems Programming

- [Memory Footprint Reduction](https://awesome-repositories.com/f/operating-systems-systems-programming/memory-footprint-reduction.md) — Implements a memory-efficient dictionary loading mode to prevent crashes in resource-constrained environments. ([source](https://github.com/overtrue/pinyin))

### Software Engineering & Architecture

- [Dictionary Loading Strategies](https://awesome-repositories.com/f/software-engineering-architecture/pluggable-module-loading/dictionary-loading-strategies.md) — Provides toggled loading strategies to balance processing speed against total system memory usage.

### Web Development

- [Slug Generators](https://awesome-repositories.com/f/web-development/url-generators/slug-generators.md) — Converts Chinese phrases into Pinyin-based permalinks for SEO-friendly URL slugs.
- [URL Pinyin Slug Generators](https://awesome-repositories.com/f/web-development/url-pinyin-slug-generators.md) — Transforms Chinese text into hyphenated or dotted Pinyin strings suitable for web permalinks and SEO friendly URLs. ([source](https://github.com/overtrue/pinyin/blob/master/README.md))
