Socket
Socket
Sign inDemoInstall

hanzi-tools

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hanzi-tools

Converts from Chinese characters to pinyin, between simplified and traditional, and does word segmentation.


Version published
Weekly downloads
27
decreased by-6.9%
Maintainers
1
Weekly downloads
 
Created
Source

pinyinify

转换汉字为拼音。 Convert Chinese characters to pinyin.

> pinyinify("转换汉字为拼音。")
"zhuǎnhuàn hànzì wéi pīnyīn."

安装 Installation

npm install pinyinify

用法 Usage

var pinyinify = require("pinyinify");
console.log(pinyinify("你好!你今天吃饭了没?"));
// nǐhǎo! nǐ jīntiān chīfàn le méi?

详细输出 Detailed output

pinyinify("人人生而自由,在尊严和权利上一律平等。", true)
// { 
//   segments: ['人人', '生而自由', ',', '在', '尊严', '和', '权利', '上', '一律平等', '。'],
//   pinyinSegments: ['rénrén', 'shēngérzìyóu', ',', 'zài', 'zūnyán', 'hé', 'quánlì', 'shàng', 'yīlǜpíngděng', '.'],
//   pinyinSegmentsSyllables: [['rén', 'rén'], ['shēng', 'ér', 'zì', 'yóu'], [','], ['zài'], ['zūn', 'yán'], ['hé'], ['quán', 'lì'], ['shàng'], ['yī', 'lǜ', 'píng', 'děng', '.']],
//   pinyin: 'rénrén shēngérzìyóu, zài zūnyán hé quánlì shàng yīlǜpíngděng.' 
// }

Keywords

FAQs

Package last updated on 19 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc