UNPKG

@gdyfe/ssml

Version:
49 lines (48 loc) 1.29 kB
import type { LabelValue } from '../model'; export interface PolyphoneData { /** * 单个汉字 */ word: string; /** * 拼音列表: 例如 wo0 wo1 wo2 wo3 wo4 */ pinyin: string[]; } export declare function getPolyphoneData(word: string): PolyphoneData; /** * 将数字音调0转为5 * @param pinyin 数字音调拼音 * @returns */ export declare function convertSoftlyTo5(pinyin: string): string; /** * 去除数字音调0 * @param pinyin 数字音调拼音 * @returns */ export declare function clearSoftly0(pinyin: string): string; /** * * @param data 多音字及拼音 * @returns 拼音LabelValue[], 例如: * ```ts * [{ label: 'dōu', value: 'dou1' }, { label: 'dou', value: 'dou0' }] * ``` */ export declare function polyphoneDataToLabelValue(data: PolyphoneData): LabelValue[]; /** * 获取拼音的声调列表 * @param input 输入的拼音,如 "he" * @returns LabelValue[] 返回带声调和数字声调的对象数组 * @example * getToneList("he") 返回: * [ * { label: "he", value: "he0" }, * { label: "hē", value: "he1" }, * { label: "hé", value: "he2" }, * { label: "hě", value: "he3" }, * { label: "hè", value: "he4" } * ] */ export declare function getToneList(input: string): LabelValue[];