pinyin-pro
Advanced tools
Comparing version 3.19.6 to 3.20.0-beta.1
{ | ||
"name": "pinyin-pro", | ||
"version": "3.19.6", | ||
"version": "3.20.0-beta.1", | ||
"description": "准确率和性能最优异的汉字转拼音库。获取中文拼音、韵母、声母、声调、首字母,支持拼音匹配", | ||
@@ -82,2 +82,2 @@ "main": "./dist/index.js", | ||
} | ||
} | ||
} |
@@ -160,8 +160,8 @@ [![pinyin-pro Logo](https://github.com/zh-lx/pinyin-pro/assets/73059627/79ffc02d-d223-40f9-a223-ddd2a9c9534b)](https://github.com/zh-lx/pinyin-pro) | ||
<td rowspan="2" colspan="2">准确率</td> | ||
<td>😕 Node 版: 97.331%</td> | ||
<td rowspan="2">😕 97.279%</td> | ||
<td rowspan="2">🤩 99.795%</td> | ||
<td>😕 Node 版: 95.277%</td> | ||
<td rowspan="2">😕 95.123%</td> | ||
<td rowspan="2">🤩 99.846%</td> | ||
</tr> | ||
<tr> | ||
<td>😕 Web 版: 94.353% </td> | ||
<td>😕 Web 版: 92.197% </td> | ||
</tr> | ||
@@ -168,0 +168,0 @@ <tr> |
export declare const DoubleUnicodePrefixReg: RegExp; | ||
export declare const DoubleUnicodeSuffixReg: RegExp; | ||
export declare const DoubleUnicodeReg: RegExp; | ||
export declare enum Priority { | ||
DictNumber = 15, | ||
DICT2 = 20, | ||
DICT3 = 30, | ||
DICT4 = 40, | ||
DICT5 = 50, | ||
Surname = 99, | ||
Custom = 999 | ||
} |
@@ -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'; |
@@ -1,2 +0,2 @@ | ||
declare type ConvertFormat = 'numToSymbol' | 'symbolToNum' | 'toneNone'; | ||
type ConvertFormat = 'numToSymbol' | 'symbolToNum' | 'toneNone'; | ||
interface ConvertOptions { | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
declare type CustomHandleType = 'add' | 'replace'; | ||
declare type CustomDictType = 'pinyin' | 'multiple' | 'polyphonic'; | ||
type CustomHandleType = 'add' | 'replace'; | ||
type CustomDictType = 'pinyin' | 'multiple' | 'polyphonic'; | ||
interface CustomPinyinOptions { | ||
@@ -4,0 +4,0 @@ /** |
@@ -26,2 +26,14 @@ interface HtmlOptions { | ||
toneType?: 'symbol' | 'num' | 'none'; | ||
/** | ||
* @description 对于指定的汉字及字符,在 result 上额外补充的拼音 | ||
*/ | ||
customClassMap?: { | ||
[classname: string]: string[]; | ||
}; | ||
/** | ||
* @description 是否对"一"和"不"开启变调。默认开启。参考:https://zh.wiktionary.org/wiki/Appendix:%E2%80%9C%E4%B8%80%E2%80%9D%E5%8F%8A%E2%80%9C%E4%B8%8D%E2%80%9D%E7%9A%84%E5%8F%98%E8%B0%83 | ||
* @value true:开启 | ||
* @value false:不开启 | ||
*/ | ||
inflection?: boolean; | ||
} | ||
@@ -34,3 +46,3 @@ /** | ||
*/ | ||
export declare const html: (text: string, options?: HtmlOptions | undefined) => string; | ||
export declare const html: (text: string, options?: HtmlOptions) => string; | ||
export {}; |
@@ -30,3 +30,3 @@ interface MatchOptions { | ||
*/ | ||
export declare const match: (text: string, pinyin: string, options?: MatchOptions | undefined) => any; | ||
export declare const match: (text: string, pinyin: string, options?: MatchOptions) => any; | ||
export {}; |
import type { SingleWordResult, PinyinMode } from '../../common/type'; | ||
/** | ||
* @description: 获取单个字符的拼音 | ||
* @param {string} word | ||
* @return {string} | ||
*/ | ||
type GetSingleWordPinyin = (word: string) => string; | ||
export declare const getSingleWordPinyin: GetSingleWordPinyin; | ||
export declare const getPinyin: (word: string, list: SingleWordResult[], mode: 'normal' | 'surname') => SingleWordResult[]; | ||
@@ -8,3 +15,3 @@ /** | ||
*/ | ||
declare type GetPinyinWithoutTone = (pinyin: string) => string; | ||
type GetPinyinWithoutTone = (pinyin: string) => string; | ||
declare const getPinyinWithoutTone: GetPinyinWithoutTone; | ||
@@ -16,3 +23,3 @@ /** | ||
*/ | ||
declare type GetMultiplePinyin = (word: string, mode?: PinyinMode) => SingleWordResult[]; | ||
type GetMultiplePinyin = (word: string, mode?: PinyinMode) => SingleWordResult[]; | ||
declare const getMultiplePinyin: GetMultiplePinyin; | ||
@@ -24,3 +31,3 @@ /** | ||
*/ | ||
declare type GetInitialAndFinal = (pinyin: string) => { | ||
type GetInitialAndFinal = (pinyin: string) => { | ||
final: string; | ||
@@ -35,3 +42,3 @@ initial: string; | ||
*/ | ||
declare type GetFinalParts = (pinyin: string) => { | ||
type GetFinalParts = (pinyin: string) => { | ||
head: string; | ||
@@ -47,3 +54,3 @@ body: string; | ||
*/ | ||
declare type GetNumOfTone = (pinyin: string) => string; | ||
type GetNumOfTone = (pinyin: string) => string; | ||
declare const getNumOfTone: GetNumOfTone; | ||
@@ -56,3 +63,3 @@ /** | ||
*/ | ||
declare type GetPinyinWithNum = (pinyin: string, originPinyin: string) => string; | ||
type GetPinyinWithNum = (pinyin: string, originPinyin: string) => string; | ||
declare const getPinyinWithNum: GetPinyinWithNum; | ||
@@ -64,4 +71,4 @@ /** | ||
*/ | ||
declare type GetFirstLetter = (pinyin: string) => string; | ||
type GetFirstLetter = (pinyin: string) => string; | ||
declare const getFirstLetter: GetFirstLetter; | ||
export { getPinyinWithoutTone, getInitialAndFinal, getMultiplePinyin, getNumOfTone, getPinyinWithNum, getFirstLetter, getFinalParts, }; |
@@ -52,2 +52,8 @@ interface BasicOptions { | ||
v?: boolean; | ||
/** | ||
* @description 是否对"一"和"不"开启变调。默认开启。参考:https://zh.wiktionary.org/wiki/Appendix:%E2%80%9C%E4%B8%80%E2%80%9D%E5%8F%8A%E2%80%9C%E4%B8%8D%E2%80%9D%E7%9A%84%E5%8F%98%E8%B0%83 | ||
* @value true:开启 | ||
* @value false:不开启 | ||
*/ | ||
inflection?: boolean; | ||
} | ||
@@ -54,0 +60,0 @@ interface AllData { |
@@ -22,1 +22,2 @@ import type { SingleWordResult } from '../../common/type'; | ||
export declare const middlewareDoubleUnicode: (list: SingleWordResult[]) => SingleWordResult[]; | ||
export declare const middlewareInflection: (list: SingleWordResult[], inflection: boolean) => SingleWordResult[]; |
@@ -0,1 +1,2 @@ | ||
import type { Pattern } from '../common/ac'; | ||
export declare const InitialList: string[]; | ||
@@ -27,1 +28,6 @@ export declare const SpecialInitialList: string[]; | ||
export declare const doubleFinalList: string[]; | ||
export declare const PatternNumberDict: Pattern[]; | ||
export declare const inflectionList: string[]; | ||
export declare function processInflection(cur: string, pre: string, next: string): string | undefined; | ||
export declare function processInflectionLiao(cur: string, pre: string): "liǎo" | undefined; | ||
export declare function processSepecialPinyin(cur: string, pre: string, next: string): string; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27
770334
13717
1