BlueBird.Pinyins 1.3.0

dotnet add package BlueBird.Pinyins --version 1.3.0
                    
NuGet\Install-Package BlueBird.Pinyins -Version 1.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlueBird.Pinyins" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BlueBird.Pinyins" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="BlueBird.Pinyins" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BlueBird.Pinyins --version 1.3.0
                    
#r "nuget: BlueBird.Pinyins, 1.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BlueBird.Pinyins@1.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BlueBird.Pinyins&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=BlueBird.Pinyins&version=1.3.0
                    
Install as a Cake Tool

BlueBird.Pinyins

A lightweight, zero-dependency .NET library for converting Chinese characters to Pinyin, extracting initials, and finding characters by Pinyin.

Installation

dotnet add package BlueBird.Pinyins

Quick Start

using System.Text;
using BlueBird.Pinyins;

Pinyin.GetPinyin("中国");          // "zhongguo"
Pinyin.GetPinyin("中国", " ");     // "zhong guo"

Pinyin.GetInitials("你好");        // "nh"
Pinyin.GetInitials("你好", "-");   // "n-h"

Pinyin.GetPinyin(new Rune('中'));  // "zhong"
Pinyin.TryGetPinyin(new Rune('中'), out string? pinyin); // true

Pinyin.GetCharacters("zhong");    // "中种重众钟..."

API

Method Description
GetPinyin(string?, string?) Converts text to Pinyin. An optional separator is inserted between the result for each input character.
GetInitials(string?, string?) Extracts Pinyin initials. An optional separator is inserted between the result for each input character.
GetPinyin(Rune) Returns the Pinyin for one Unicode character, or the original character when it is not found.
TryGetPinyin(Rune, out string?) Attempts to find the Pinyin for one Unicode character.
GetCharacters(string?) Returns the characters matching a complete, tone-free Pinyin syllable.

The string APIs return null when their input is null. GetCharacters trims surrounding whitespace, ignores case, and returns an empty string when no match is found.

Limitations

  • Each character maps to one default tone-free Pinyin reading. Context-dependent pronunciations and tones are not supported.
  • The library uses v for ü, as in lv, nv, lve, and nve.
  • When converting text, characters not included in the Pinyin data are returned unchanged.

Upgrading from 1.2

Version 1.3 renames GetChineseText to GetCharacters and replaces GetPinyin(char) with the Unicode-safe GetPinyin(Rune) API.

Implementation

  • No runtime dependencies; all Pinyin data is embedded in the assembly.
  • Text is processed with Rune to preserve Unicode surrogate pairs.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 105 8/30/2026
1.2.0 166 6/7/2026
1.1.0 219 5/30/2026
1.0.0 144 5/24/2026

Breaking changes: GetChineseText is renamed to GetCharacters, and GetPinyin(char) is replaced by GetPinyin(Rune). Also adds TryGetPinyin, Unicode-safe text handling, faster character lookup, broader simplified and traditional Chinese character coverage, and improved default Pinyin mappings.