# pinyin_to_hanzi

> A package to convert pinyin to hanzi (Chinese character) eg: "nihao" -> "你好"

Latest version **0.1.0** (published 2023-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install pinyin_to_hanzi
pnpm add pinyin_to_hanzi
yarn add pinyin_to_hanzi
bun add pinyin_to_hanzi
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2023-09-15 |
| First published | 2023-09-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.9 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jesse Deng |
| Maintainers | jmikael_77 |
| Keywords | pinyin, hanzi, chinese, converter |

## Links

- npm: https://www.npmjs.com/package/pinyin_to_hanzi
- Repository: https://github.com/torphix/pinyin-hanzi-wasm.git#main
- Homepage: https://github.com/torphix/pinyin-hanzi-wasm/tree/main#readme
- Issues: https://github.com/torphix/pinyin-hanzi-wasm/issues
- npm.io page: https://npm.io/package/pinyin_to_hanzi

## Recent versions

- 0.1.0 (latest) — 2023-09-15

## README

# What is it?

A package to convert pinyin to hanzi (Chinese character) eg: "nihao" -> "你好"

# How it works

1. Using a large Chinese corpus scan the most frequently occuring words
2. Order the words based on frequency
3. When the user types in pinyin find the most common characters
4. If no matching values return the top partial matching values
5. Uses WASM for speed

# How to use it

```javascript
import init, { pinyin_to_hanzi } from "./pinyin_to_hanzi.js";

async function initializeWASM() {
	await init(); // Initialize the WASM module
}

async function runTest(pinyinInput) {
	const result = pinyin_to_hanzi(pinyinInput);
	// Result is a list of strings
}

initializeWASM(); // Initialize WASM as soon as the script loads
```

---
_Source: https://npm.io/package/pinyin_to_hanzi · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
