Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/baranwang/pinyin

Node.js 汉字转拼音
https://github.com/baranwang/pinyin

chinese npm pinyin

Last synced: 4 days ago
JSON representation

Node.js 汉字转拼音

Awesome Lists containing this project

README

        

# Pinyin

[![](https://img.shields.io/npm/v/@baranwang/pinyin)](https://www.npmjs.com/package/@baranwang/pinyin)
[![Node.js Package](https://github.com/baranwang/pinyin/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/baranwang/pinyin/actions/workflows/npm-publish.yml)
![](https://img.shields.io/npm/l/@baranwang/pinyin)

Node.js 汉字转拼音,支持多音字,自动分词

## 安装

```shell
npm i @baranwang/pinyin
# or
yarn add @baranwang/pinyin
# or
pnpm add @baranwang/pinyin
```

## 使用

```javascript
const { Pinyin } = require("@baranwang/pinyin");

const pinyin = new Pinyin();

pinyin.get("你好"); // [["nǐ hǎo"]]
```

## 关于

### 词典来源
[mozillazg/pinyin-data](https://github.com/mozillazg/pinyin-data.git)

[mozillazg/phrase-pinyin-data](https://github.com/mozillazg/phrase-pinyin-data.git)

### 分词
[novel-segment](https://github.com/bluelovers/ws-segment/tree/master/packages/novel-segment)