Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pinyin-pro

Package Overview
Dependencies
Maintainers
1
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pinyin-pro - npm Package Compare versions

Comparing version 3.14.0 to 3.14.1-beta.1

CHANGELOG.md

14

package.json
{
"name": "pinyin-pro",
"version": "3.14.0",
"version": "3.14.1-beta.1",
"description": "准确率和性能最优异的汉字转拼音库。获取中文拼音、韵母、声母、声调、首字母,支持拼音匹配",

@@ -42,2 +42,14 @@ "main": "./dist/index.js",

"homepage": "https://pinyin-pro.cn",
"exports": {
".": {
"import": {
"types": "./types/lib/index.d.ts",
"default": "./dist/index.es.js"
},
"require": {
"types": "./types/lib/index.d.ts",
"default": "./dist/index.js"
}
}
},
"devDependencies": {

@@ -44,0 +56,0 @@ "@commitlint/cli": "^11.0.0",

@@ -11,3 +11,3 @@ [![pinyin-pro Logo](https://t1.wodetu.cn/2022/11/15/168e8a29acc856c48fdef4060c0ba5ad.png)](https://github.com/zh-lx/pinyin-pro)

### 介绍
### 📖 介绍

@@ -18,3 +18,3 @@ `pinyin-pro` 是一个专业的 js 汉字拼音转换库,功能丰富、准确率高、性能优异。

### 特色功能
### 🎨 特色功能

@@ -32,3 +32,3 @@ - 获取汉字、词语、句子等多种格式的拼音

### 安装
### 🔨 安装

@@ -47,3 +47,3 @@ npm 安装

### 使用示例
### 💡 使用示例

@@ -68,15 +68,59 @@ 更多功能的使用说明文档请查看[使用示例](https://pinyin-pro.cn/use/pinyin)

### 性能及准确率
### 🏆 竞品对比
以下是 `pinyin-pro` 及 `pinyin` 包对于汉字转换的速度及准确率对比,更多细节可以参考
以下是 `pinyin-pro`、`pinyin` 及 `@napi-rs/pinyin` 包对于汉字转换的速度及准确率对比,可以看到 `pinyin-pro` 在各方面都全面领先。
- 准确率测试数据: [accuracy](https://github.com/zh-lx/pinyin-pro/blob/main/benchmark/accuracy.js)
- 性能测试数据:[speed](https://github.com/zh-lx/pinyin-pro/blob/main/benchmark/speed.js)
<table>
<tr>
<th colspan="2">对比项</th>
<th>pinyin</th>
<th>@napi-rs/pinyin</th>
<th>pinyin-pro</th>
</tr>
<tr>
<td rowspan="2" colspan="2">准确率</td>
<td>😕 Node 版: 97.844%</td>
<td rowspan="2">😕 97.433%</td>
<td rowspan="2">🤩 99.744%</td>
</tr>
<tr>
<td>😕 Web 版: 94.507% </td>
</tr>
<tr>
<td rowspan="3">性能</td>
<td>5k字转换耗时</td>
<td>🐢 749.111ms</td>
<td>🚲 200.877ms</td>
<td>🚀 5.958ms</td>
</tr>
<tr>
<td>1w字转换耗时</td>
<td>🐢 795.904ms</td>
<td>🚲 206.5ms</td>
<td>🚀 15.260ms</td>
</tr>
<tr>
<td>100w字转换耗时</td>
<td>⛔ 内存溢出转换失败</td>
<td>🚀 638.888ms</td>
<td>🚀 607.131ms</td>
</tr>
<tr>
<td rowspan="2">兼容性</td>
<td>Web 环境</td>
<td>✔️ 支持</td>
<td>❌ 不支持</td>
<td>✔️ 支持</td>
</tr>
<tr>
<td>Node 环境</td>
<td>✔️ 支持</td>
<td>✔️ 支持</td>
<td>✔️ 支持</td>
</tr>
</table>
| 对比项 | pinyin | pinyin-pro |
| ------------------- | ---------------- | ---------- |
| 准确率 | 95.894% | 99.744% |
| 5k 字转换所需时间 | 190.192ms | 7.199ms |
| 1w 字转换所需时间 | 内存溢出转换失败 | 13.199ms |
| 100w 字转换所需时间 | 内存溢出转换失败 | 646.973ms |
### 📠 反馈
### 反馈
使用遇到问题或者需要功能支持欢迎提 issue。

@@ -83,0 +127,0 @@

declare const InitialList: string[];
export default InitialList;

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ export declare function customPinyin(config?: {

@@ -0,0 +0,0 @@ /**

export { pinyin } from './pinyin/index';
export { customPinyin } from './custom';
export { match } from './match';

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ interface BasicOptions {

@@ -0,0 +0,0 @@ import { SingleWordResult } from '../type';

@@ -0,0 +0,0 @@ interface BasicOptions {

@@ -0,0 +0,0 @@ import { CompleteOptions } from './index';

@@ -0,0 +0,0 @@ export interface SingleWordResult {

export declare function getStringLength(string: string): number;
export declare function getSplittedWord(string: string): string[];
export declare function isZhChar(char: string): boolean;

14

types/pinyin/handle.d.ts

@@ -8,3 +8,3 @@ import { SingleWordResult, PinyinMode } from '../type';

*/
declare type GetPinyinWithoutTone = (pinyin: string) => string;
type GetPinyinWithoutTone = (pinyin: string) => string;
declare const getPinyinWithoutTone: GetPinyinWithoutTone;

@@ -16,3 +16,3 @@ /**

*/
declare type GetMultiplePinyin = (word: string, mode?: PinyinMode) => SingleWordResult[];
type GetMultiplePinyin = (word: string, mode?: PinyinMode) => SingleWordResult[];
declare const getMultiplePinyin: GetMultiplePinyin;

@@ -24,3 +24,3 @@ /**

*/
declare type GetInitialAndFinal = (pinyin: string) => {
type GetInitialAndFinal = (pinyin: string) => {
final: string;

@@ -35,3 +35,3 @@ initial: string;

*/
declare type GetFinalParts = (pinyin: string) => {
type GetFinalParts = (pinyin: string) => {
head: string;

@@ -47,3 +47,3 @@ body: string;

*/
declare type GetNumOfTone = (pinyin: string) => string;
type GetNumOfTone = (pinyin: string) => string;
declare const getNumOfTone: GetNumOfTone;

@@ -56,3 +56,3 @@ /**

*/
declare type GetPinyinWithNum = (pinyin: string, originPinyin: string) => string;
type GetPinyinWithNum = (pinyin: string, originPinyin: string) => string;
declare const getPinyinWithNum: GetPinyinWithNum;

@@ -64,4 +64,4 @@ /**

*/
declare type GetFirstLetter = (pinyin: string) => string;
type GetFirstLetter = (pinyin: string) => string;
declare const getFirstLetter: GetFirstLetter;
export { getPinyinArray, getPinyinWithoutTone, getInitialAndFinal, getMultiplePinyin, getNumOfTone, getPinyinWithNum, getFirstLetter, getFinalParts, };

@@ -8,3 +8,3 @@ export interface SingleWordResult {

}
export declare type ToneType = 'symbol' | 'num' | 'none';
export declare type PinyinMode = 'normal' | 'surname';
export type ToneType = 'symbol' | 'num' | 'none';
export type PinyinMode = 'normal' | 'surname';

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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