feat: 目录改造

This commit is contained in:
tackchen 2020-12-16 14:08:02 +08:00
parent 98cf22b47e
commit 4b41540ce1
121 changed files with 39 additions and 38327 deletions

View File

@ -7,12 +7,14 @@ const version = require('../package.json').version;
const plugins = ['order', 'poly', 'trad', 'draw', 'idiom', 'xhy', 'radical'];
const alias = ['cnchar-all', 'hanzi-util', 'hanzi-util-base'];
const depFiles = alias.map(alia => `../src/alias/${alia}/package.json`);
const files = [
...plugins.map(plugin => `../npm/${plugin}/package.json`),
'../npm/cnchar/package.json',
'../npm/all/package.json',
'../npm/hanzi-util/package.json',
'../npm/hanzi-util-base/package.json',
'../src/main/package.json',
...plugins.map(plugin => `../src/plugin/${plugin}/package.json`),
...depFiles,
];
function modVersion () {
@ -24,11 +26,6 @@ function modVersion () {
});
});
}
const depFiles = [
'../npm/all/package.json',
'../npm/hanzi-util/package.json',
'../npm/hanzi-util-base/package.json'
];
function modDep () {
depFiles.forEach(file => {
@ -55,7 +52,7 @@ function task () {
function buildPluginGulpFiles (plugin) {
const path = `src/plugin/${plugin}/`;
return [`${path}dict/*.json`, `${path}types`, `${path}*.d.ts`];
return [`${path}types/*.*`, `${path}*.d.ts`];
}
function gulpPlugin (plugin) {
@ -64,16 +61,16 @@ function gulpPlugin (plugin) {
}
function copyToNPM () {
const gulpReadme = gulp.src(['helper/README.md', 'LICENSE'])
let gulpReadme = gulp.src(['helper/README.md', 'LICENSE'])
.pipe(toc())
.pipe(gulp.dest('.'))
.pipe(gulp.dest('npm/cnchar'));
plugins.forEach(plugin => {
gulpReadme = gulpReadme.pipe(`npm/${plugin}`);
gulpReadme = gulpReadme.pipe(gulp.dest(`npm/${plugin}`));
});
gulp.src(['src/main/dict/*.json', 'src/main/types', 'src/main/*.d.ts'])
gulp.src(['src/main/types/*.*', 'src/main/*.d.ts'])
.pipe(gulp.dest('npm/cnchar'));
plugins.forEach(plugin => {

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 - present theajack <contact@theajack.com>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,36 +0,0 @@
# [cnchar-all](https://github.com/theajack/cnchar)
#### [theajack](https://www.theajack.com/)
### 功能全面、多端支持的汉字拼音笔画js库
[api详细文档地址](https://www.theajack.com/cnchar/)
----
[TOC]
----
词库为cnchar的完整功能版本
```
npm i cnchar-all
```
### 1.功能
1. 获取 **汉字拼音** ,支持首字母、大小写、数组分割、备选 **多音字** 等功能
2. 支持 **多音词**
3. 支持 **拼音音调**
4. 获取汉字 **笔画数** 、支持数组分割
5. 获取汉字 **笔画顺序** 、笔画详细名称、通过笔画顺序推出原汉字等
6. 支持 **简体字****繁体字****火星文** 互转
7. 支持 **查找** 某拼音的所有 **汉字** ,繁体字,多音字
8. 支持 **查找** 指定笔画数的所有 **汉字** ,繁体字
9. 支持 **查询拼音的信息**,包含声母、韵母、音调、音调位置的等
10. 支持 **繁体字** 拼音、笔画数及以上所有功能,实现和简体字一样的功能
11. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
12. **多端可用**,可用于 原生浏览器环境、webpack 环境、nodejs 环境...,几乎支持所有 js 能运行的环境
13. 丰富的配置,按需取用
### 2.详细文档
[cnchar](https://github.com/theajack/cnchar/blob/master/README.md#cnchar)

File diff suppressed because one or more lines are too long

13
npm/all/extend.d.ts vendored
View File

@ -1,13 +0,0 @@
declare type spellArgs = 'array' | 'low' | 'up' | 'first' | 'poly' | 'tone' | 'simple' | 'trad';
declare type strokeArgs = 'letter' | 'shape' | 'count' | 'name' | 'detail' | 'array' | 'order' | 'simple' | 'trad';
interface String {
spell(...args: Array<spellArgs>): string | Array<any>;
stroke(...args: Array<strokeArgs>): number | Array<any>;
convertSimpleToTrad(): string;
convertSimpleToSpark(): string;
convertTradToSimple(): string;
convertTradToSpark(): string;
convertSparkToSimple(): string;
convertSparkToTrad(): string;
}

189
npm/all/index.d.ts vendored
View File

@ -1,189 +0,0 @@
// all库的声明文件
import './extend';
// draw
declare type DrawType = 'normal' | 'animation' | 'stroke' | 'test';
declare type TestStatusType = 'mistake' | 'correct' | 'complete';
declare class Writer {
constructor();
option: object;
el: HTMLElement;
type: DrawType;
text: Array<string>;
writer: Array<object>;
animateStart():void;
}
declare interface TestStatus {
index: number,
status: TestStatusType,
data: {
character: string;
totalMistakes: number;// 到目前为止在测验期间犯的总错误。
strokeNum?: number;// 当前笔画数。
mistakesOnStroke?: number;// 到目前为止用户绘制此笔划所犯的错误数。
strokesRemaining?: number;// 测验完成前剩余的笔画数。
drawnPath?: {
pathString: string;
points: Array<{x:number;y:number}>
};// 对象包含用户绘制的 pathString ,用于评分的分数。
}
}
declare interface DrawOption {
el?: string | HTMLElement; // 绘制的容器支持选择器或dom若是不填会在body后append一个dom作为容器
type?: DrawType; // 绘制模式默认为normal
clear?: boolean; // 绘制前是否清空容器 默认为true
style?: { // 样式类
backgroundColor?: string, // 默认为#fff
showOutline?: boolean;//: true,
showCharacter?: boolean;//: true,
currentColor?: string;//: '#b44', // 仅在stroke模式下有效
length?: number;//: 60,
padding?: number;//: 5, // 数值, 默认 20。 画布的汉字和边缘之间的填充
outlineColor?: string;//: '#ddd', // 十六进制字符, 默认 '#DDD'。
strokeColor?: string;//: '#555', // 十六进制字符, 默认 '#555'。绘制每个笔划的颜色。
radicalColor?: string;//: null, // 十六进制字符, 默认 null。 如果存在偏旁部首数据,则在笔划中绘制偏旁部首的颜色。 如果没有设置,激光将绘制与其他笔划相同的颜色。
strokeFadeDuration?: number; //400
},
line?: { // 背景线条类
lineStraight?: boolean;// : true,
lineCross?: boolean;// : true,
lineWidth?: number;// : 1,
lineColor?: string;// : '#ddd',
lineDash?: boolean;// : true,
border?: boolean;// : true,
borderWidth?: number;// : 1,
borderColor?: string;// : '#ccc',
borderDash?: boolean;// : false,
},
animation?: {
strokeAnimationSpeed?: number;// : 1, // 数值, 默认 1。 绘制每个笔划的速度必须大于0。增加此数字可以更快地绘制笔划减少绘制笔划的速度更慢。
delayBetweenStrokes?: number;// : 1000, // 数值, 默认 1000。 动画进行中每个笔画之间的间隔时间(以毫秒为单位)。
delayBetweenLoops?: number;// : 200, // 数值, 默认 2000。 循环动画时每个动画循环之间的时间(以毫秒为单位)。
autoAnimate?: boolean;// : true,
animateComplete?: Function;// : () => {},
stepByStep?: boolean;// : true,
loopAnimate?: boolean;// : false,
},
test?: {
strokeHighlightSpeed?: number;// : 20, // 数值, 默认 20。 在测验中给出提示时突出显示每个笔划的速度必须大于0。增加此数字以突出显示更快减少以突出显示更慢。
highlightColor?: number;// : '#aaf', // 十六进制字符, 默认 '#AAF'。 用于在测验中突出显示的颜色。
drawingColor?: number;// : '#333', // 十六进制字符, 默认 '#333'。 测验期间绘制的线条颜色。
drawingWidth?: number;// : 4, // 数值, 默认 4。 进行测验时绘制的线条宽度。
showHintAfterMisses?: number;// : 3, // 整数, 默认 3 中风高亮提示之前的未命中数被给予用户。 设置为 false 以禁用。 创建测验时也可以设置此项。
highlightOnComplete?: number;// : true, // 布尔值, 默认 true。 控制当用户完成绘制整个字符时,测验是否会短暂突出显示字符。 创建测验时也可以设置此项。
highlightCompleteColor?: number;// : null, // 十六进制字符, 默认 null。 在测验中突出显示字符时使用的颜色。 如果未设置则将使用highlightColor。 仅当highlightOnComplete为true时才相关。
onTestStatus?(args: TestStatus):void;// : null, // ({index, status, data})=>{}
}
}
export declare interface Draw {
(text:string, option?:DrawOption):Writer;
TYPE: {
ANIMATION: 'animation',
NORMAL: 'normal',
STROKE: 'stroke',
TEST: 'test'
},
TEST_STATUS: {
MISTAKE: 'mistake',
CORRECT: 'correct',
COMPLETE: 'complete'
}
}
// idiom
declare type idiomArg = 'char' | 'stroke' | 'spell' | 'tone';
export declare interface Idiom {
(text:string | Array<string|number>, ...idiomArgs: Array<idiomArg>):Array<string>;
}
// order
declare type orderToWordArg = 'match' | 'matchorder' | 'contain' | 'start' | 'array' | 'simple' | 'trad';
declare type orderName = '横折折撇' | '竖弯' | '横折' | '撇点' | '横斜钩' | '横' | '捺' | '横折钩' | '竖' | '竖钩' | '点' | '撇' | '撇折' | '竖折撇' | '横折折折钩' | '竖折折钩' | '提' | '弯钩' | '斜钩' | '横折折' | '横撇' | '横折提' | '横折折折' | '竖提' | '竖弯钩'
| '竖折折' | '横撇弯钩' | '卧钩' | '横折弯' | '横钩';
// xhy
declare type xhyArg = 'fuzzy' | 'answer' | 'second';
export declare interface XHY {
(text:string, ...xhyArgs: Array<xhyArg>):Array<string>;
}
declare type spellArg = 'array' | 'low' | 'up' | 'first' | 'poly' | 'tone' | 'simple' | 'trad';
declare type strokeArg = 'letter' | 'shape' | 'count' | 'name' | 'detail' | 'array' | 'order' | 'simple' | 'trad';
declare type spellToWordArg = 'poly' | 'alltone' | 'array' | 'simple' | 'trad';
declare type strokeToWordArg = 'array' | 'simple' | 'trad';
declare type pluginArg = 'order' | 'trad' | 'poly' | 'draw' | 'idiom' | 'xhy';
declare type toneType = 0 | 1 | 2 | 3 | 4;
declare type compareType = 'more' | 'less' | 'even';
declare interface spellInfoReturnStatic {
spell: string;
initial: string;
final: string;
tone: number;
index: number;
}
export declare interface CnCharStatic {
spell(sentence: string, ...args: Array<spellArg>): string | Array<any>;
stroke(sentence: string, ...args: Array<strokeArg>): number | Array<any>;
use(...plugins: Array<Function>): void;
spellToWord(spell: string, ...args: Array<spellToWordArg>): string | Array<string>;
strokeToWord(stroke: number, ...args: Array<strokeToWordArg>): string | Array<string>;
spellInfo: {
(spell: string): spellInfoReturnStatic;
tones: Array<string>;
initials: Array<string>;
};
plugins: Array<pluginArg>;
type: {
spell: object;
stroke: object;
spellToWord: object;
strokeToWord: object;
orderToWord?: object;
idiom?: object;
xhy?: object;
};
check: boolean;
readonly version: string;
transformTone(spell: string, tone?: boolean, type?: 'low' | 'up'): {
spell: string;
tone: toneType;
index: number;
isTrans: boolean;
};
isCnChar(word: string): boolean;
compareSpell(spell1: string, spell2: string, tone?: boolean): compareType;
compareStroke(stroke1: string | number, stroke2: string | number): compareType;
sortSpell(spells:Array<string> | string, ...args: Array<'tone'|'desc'>): Array<string> | string;
sortStroke(strokes:Array<string|number> | string, desc?: 'desc'): Array<string> | string;
draw: Draw;
idiom: Idiom;
orderToWord: {
(orders: string | Array<orderName>, ...args: Array<orderToWordArg>): string | Array<string>;
orders: object;
};
convert: {
simpleToSpark(sentence: string): string;
simpleToTrad(sentence: string): string;
sparkToSimple(sentence: string): string;
sparkToTrad(sentence: string): string;
tradToSimple(sentence: string): string;
tradToSpark(sentence: string): string;
};
xhy: XHY;
}
declare const cnchar: CnCharStatic;
export default cnchar;

View File

@ -1,20 +0,0 @@
"use strict";
var cnchar = require('./cnchar.all.min.js');
// var order = require('../order');
// var trad = require('../trad');
// var poly = require('../poly');
// var draw = require('../draw');
// var idiom = require('../idiom');
// var xhy = require('../xhy');
// var radical = require('../radical');
// cnchar.use(order, trad, poly, draw, idiom, xhy, radical);
module.exports = cnchar;

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 - present theajack <contact@theajack.com>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,48 +0,0 @@
"use strict";
var _cnchar = null;
var toneCodes = [];
initToneCodes();
function initToneCodes(__cnchar) {
_cnchar = __cnchar;
'aoeiuvn'.split('').forEach(function (item) {
var code = item.charCodeAt(0);
for (var i = 1; i <= 4; i++) {
toneCodes.push(code + i * 0.1);
}
});
}
function getToneCodes(_char) {
var index = _cnchar._.tones.indexOf(_char);
if (index === -1) {
return -1;
}
return toneCodes[index];
}
function getCharCode(_char2) {
var tone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (!tone) {
return _char2.charCodeAt(0);
}
var code = getToneCodes(_char2);
if (code === -1) {
return _char2.charCodeAt(0);
}
return code;
} // 比较拼音大小的方法考虑移到cnchar工具方法中
module.exports = {
initToneCodes: initToneCodes,
getCharCode: getCharCode
};

View File

@ -1,167 +0,0 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var defDict = require('./spell-default.json');
var spellDict = require('./spell-dict-jian.json');
var strokeDict = require('./stroke-count-jian.json');
var infoDict = require('./info-dict.json');
var _require = require('./util'),
mapJson = _require.mapJson;
var _require2 = require('./tool'),
transformTone = _require2.transformTone,
spell = _require2.spell,
arg = _require2.arg,
shapeSpell = _require2.shapeSpell,
stroke = _require2.stroke; // 设置多音字默认拼音
function setSpellDefault(word, spell) {
setIntoJson({
target: defDict,
key: word,
value: spell,
isSpell: true
});
}
function setIntoJson(_ref) {
var target = _ref.target,
key = _ref.key,
value = _ref.value,
_ref$isSpell = _ref.isSpell,
isSpell = _ref$isSpell === void 0 ? false : _ref$isSpell;
mapJson(key, value, function (k, v) {
if (k && v) {
target[k] = isSpell ? shapeSpell(v) : v;
}
});
}
function setIntoSpellBase(dict, currentSpell, word, spells) {
var isPoly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
if (_typeof(word) === 'object') {
for (var k in word) {
setIntoSpellBase(dict, currentSpell[k], k, word[k]);
}
return;
}
if (spells instanceof Array) {
spells.forEach(function (spell) {
setIntoSpellBase(dict, currentSpell, word, spell, true);
});
return;
}
var info = transformTone(spells);
var str = dict[info.spell];
if (currentSpell.length >= 1) {
for (var i = 0; i < currentSpell.length; i++) {
if (currentSpell[i].spell === info.spell && currentSpell[i].tone === info.tone) {
return;
}
}
if (!isPoly) isPoly = true;
}
var appendStr = "".concat(word).concat(info.tone + (isPoly ? 5 : 0));
if (!str) {
dict[info.spell] = "".concat(info.index, ":") + appendStr;
} else {
dict[info.spell] = str + appendStr;
} // 修改之前的拼音
if (currentSpell.length === 1) {
var cinfo = currentSpell[0];
dict[cinfo.spell] = dict[cinfo.spell].replace("".concat(word).concat(cinfo.tone), "".concat(word).concat(cinfo.tone + 5));
}
if (isPoly) {
addPolyWord(word);
}
}
function setIntoSpell(dict, word, spells) {
var currentSpell;
if (_typeof(word) === 'object') {
currentSpell = {};
for (var k in word) {
currentSpell[k] = _getCurrentSpellInfo(dict, k);
}
} else {
currentSpell = _getCurrentSpellInfo(dict, word);
}
setIntoSpellBase(dict, currentSpell, word, spells);
}
function _getCurrentSpellInfo(dict, word) {
var s = spell(dict, [word, arg.tone, arg.poly]);
if (s === word) {
return [];
}
if (s.indexOf('|') !== -1) {
s = s.substring(1, s.length - 1).split('|');
} else {
s = [s];
}
return s.map(function (sp) {
return transformTone(sp);
});
}
function setSpell(word, spells) {
setIntoSpell(spellDict, word, spells);
}
function setStrokeCount(word, count) {
mapJson(word, count, function (k, v) {
var oldCount = stroke(strokeDict, [k]);
if (oldCount === count) {
return;
} // 去除旧笔画数
if (oldCount !== 0) {
strokeDict[oldCount] = strokeDict[oldCount].replace(k, '');
}
if (strokeDict[v]) {
strokeDict[v] += k;
} else {
strokeDict[v] = k;
}
});
}
function addPolyWord(word) {
if (infoDict.polyWord.indexOf(word) === -1) {
infoDict.polyWord += word;
}
}
module.exports = {
setSpellDefault: setSpellDefault,
setIntoJson: setIntoJson,
setSpell: setSpell,
setIntoSpell: setIntoSpell,
setStrokeCount: setStrokeCount
};

View File

@ -1,10 +0,0 @@
"use strict";
var spell = require('./spell-dict-jian.json');
var stroke = require('./stroke-count-jian.json');
module.exports = {
spell: spell,
stroke: stroke
};

View File

@ -1,8 +0,0 @@
declare type spellArg = 'array' | 'low' | 'up' | 'first' | 'poly' | 'tone' | 'simple' | 'trad';
declare type strokeArg = 'letter' | 'shape' | 'count' | 'name' | 'detail' | 'array' | 'order' | 'simple' | 'trad';
interface String {
spell(...args: Array<spellArg>): string | Array<any>;
stroke(...args: Array<strokeArg>): number | Array<any>;
}

66
npm/cnchar/index.d.ts vendored
View File

@ -1,66 +0,0 @@
import './extend';
declare type spellArg = 'array' | 'low' | 'up' | 'first' | 'poly' | 'tone' | 'simple' | 'trad';
declare type strokeArg = 'letter' | 'shape' | 'count' | 'name' | 'detail' | 'array' | 'order' | 'simple' | 'trad';
declare type spellToWordArg = 'poly' | 'alltone' | 'array' | 'simple' | 'trad';
declare type strokeToWordArg = 'array' | 'simple' | 'trad';
declare type pluginArg = 'order' | 'trad' | 'poly' | 'draw' | 'idiom' | 'xhy' | 'radical';
declare type toneType = 0 | 1 | 2 | 3 | 4;
declare type compareType = 'more' | 'less' | 'even';
declare interface spellInfoReturnStatic {
spell: string;
initial: string;
final: string;
tone: number;
index: number;
}
export declare interface CnCharStatic {
spell(sentence: string, ...args: Array<spellArg>): string | Array<any>;
stroke(sentence: string, ...args: Array<strokeArg>): number | Array<any>;
use(...plugins: Array<Function>): void;
spellToWord(spell: string, ...args: Array<spellToWordArg>): string | Array<string>;
strokeToWord(stroke: number, ...args: Array<strokeToWordArg>): string | Array<string>;
spellInfo: {
(spell: string): spellInfoReturnStatic;
tones: Array<string>;
initials: Array<string>;
};
plugins: Array<pluginArg>;
type: {
spell: object;
stroke: object;
spellToWord: object;
strokeToWord: object;
orderToWord?: object;
idiom?: object;
xhy?: object;
radical?: object;
};
check: boolean;
readonly version: string;
transformTone(spell: string, tone?: boolean, type?: 'low' | 'up'): {
spell: string;
tone: toneType;
index: number;
isTrans: boolean;
};
isCnChar(word: string): boolean;
isPolyWord(word: string): boolean;
compareSpell(spell1: string, spell2: string, tone?: boolean): compareType;
compareStroke(stroke1: string | number, stroke2: string | number): compareType;
sortSpell(spells:Array<string> | string, ...args: Array<'tone'|'desc'>): Array<string> | string;
sortStroke(strokes:Array<string|number> | string, desc?: 'desc'): Array<string> | string;
setSpellDefault(word: string, spell: string): void;
setSpellDefault(json: {[key: string]: string}): void;
setSpell(word: string, spell: string): void;
setSpell(json: {[key: string]: string}): void;
setStrokeCount(word: string, count: number): void;
setStrokeCount(json: {[key: string]: number}): void;
shapeSpell(spell: string): string;
}
declare const cnchar: CnCharStatic;
export default cnchar;

View File

@ -1,156 +0,0 @@
"use strict";
var version = require('./version');
var _require = require('./tool'),
spell = _require.spell,
tones = _require.tones,
stroke = _require.stroke,
arg = _require.arg,
dealUpLowFirst = _require.dealUpLowFirst,
removeTone = _require.removeTone,
sumStroke = _require.sumStroke,
checkArgs = _require.checkArgs,
initCnchar = _require.initCnchar,
transformTone = _require.transformTone,
shapeSpell = _require.shapeSpell;
var _require2 = require('./util'),
has = _require2.has,
_throw = _require2._throw,
_warn = _require2._warn,
isCnChar = _require2.isCnChar,
isPolyWord = _require2.isPolyWord,
mapJson = _require2.mapJson;
var dict = require('./dict');
var _require3 = require('./config'),
setSpellDefault = _require3.setSpellDefault,
setIntoJson = _require3.setIntoJson,
setSpell = _require3.setSpell,
setStrokeCount = _require3.setStrokeCount;
var _require4 = require('./spellToWord'),
initSpellToWord = _require4.initSpellToWord;
var initStrokeToWord = require('./strokeToWord');
var _require5 = require('./sort'),
compareSpell = _require5.compareSpell,
sortSpell = _require5.sortSpell,
compareStroke = _require5.compareStroke,
sortStroke = _require5.sortStroke,
initSort = _require5.initSort;
function _spell() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return spell(dict.spell, args);
}
function _stroke() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return stroke(dict.stroke, args);
}
function initStrProto() {
String.prototype.spell = function () {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return _spell.apply(void 0, [this].concat(args));
};
String.prototype.stroke = function () {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
return _stroke.apply(void 0, [this].concat(args));
};
}
function use() {
for (var _len5 = arguments.length, plugins = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
plugins[_key5] = arguments[_key5];
}
plugins.forEach(function (f) {
if (typeof f === 'function') {
if (typeof f.init === 'function') {
f.init(cnchar);
} else {
f(cnchar);
}
}
});
}
var cnchar = {
version: version,
spell: _spell,
stroke: _stroke,
check: true,
_origin: {
spell: _spell,
stroke: _stroke
},
plugins: [],
use: use,
_: {
arg: arg,
has: has,
_throw: _throw,
tones: tones,
setIntoJson: setIntoJson,
_warn: _warn,
dealUpLowFirst: dealUpLowFirst,
removeTone: removeTone,
sumStroke: sumStroke,
isCnChar: isCnChar,
checkArgs: checkArgs,
transformTone: transformTone,
dict: {},
mapJson: mapJson
},
type: {
spell: arg,
stroke: {
array: arg.array
}
},
// 工具方法
transformTone: transformTone,
isCnChar: isCnChar,
compareSpell: compareSpell,
compareStroke: compareStroke,
sortSpell: sortSpell,
sortStroke: sortStroke,
setSpellDefault: setSpellDefault,
setSpell: setSpell,
setStrokeCount: setStrokeCount,
isPolyWord: isPolyWord,
shapeSpell: shapeSpell
};
function init() {
initStrProto();
initCnchar(cnchar);
initSpellToWord(cnchar);
initStrokeToWord(cnchar);
initSort(cnchar);
if (typeof window !== 'undefined') {
window.cnchar = window.CnChar = cnchar;
}
}
init();
module.exports = cnchar;

View File

@ -1,4 +0,0 @@
{
"initial": ["b", "p", "m", "f", "d", "t", "n", "l", "g", "k", "h", "j", "q", "x", "zh", "ch", "sh", "r", "z", "c", "s", "y", "w"],
"polyWord": "唉挨嗳义艾依椅嗌噫钉酊丁正争怔诤挣政症铮妻乜了钌撩燎瞭佴铒任蕃朴繁泊柏啵膊魄薄簸叭伯把杷耙靶鲅扒吧罢栖蹊娭几纪齐系亟其奇济给荠缉稽看倒丽哩蠡泡炮跑刨剥趵参甚葚什食莳桄广张涨厂长场倡叉杈衩差碴刺伺似俟有柚万没抹磨散糁上裳个仡各革格胳鬲搁葛饹压哑雅呀佗说耶掖相处与予吁雨禺语菀尢王亡兀乌无於恶捎稍欠茜为尾委尉隗遗蔚吐菟打答瘩大待逮子仔兹茈訾节价结偈接解藉倔肖蛸共供仅尽禁干杆赣疟要铫繇采偲发菲蜚吗蚂麻摩孖堡卜芥盖帱传转中种风葑缝石担疸惮瘅儋单苫钐扇掸掺氏只吱识织峙殖荼数员芸晕熨合吓纥何和荷喝戏芴虎核唬鹄糊劲径经仆埔铺暴瀑曝仇湫蝤艿论抡媛缘溜遛馏镏六陆碌蓼那哪内扛岗杠钢分切砌慊卷圈般勾枸化划华哗吡纰芘陂铍埤睥裨辟劈沤区曲撒片便扁缏褊吖阿呵啊胺蛾町梃铤爽台呔苔骀夫父孚芾怫服脯跗夭拗熬嚣空圻饮尺匙屯咳害还圜捻楷芯莘熟扎轧咋咤查栅炸喳猹楂槎汶闷斗坊乐约栎钥莫模茆冒旄猫豁伙仿彷膀伴扳拌胖袢番瓦袜哇奸间浅监渐溅犍锏槛见纤洗铣鲜孛背被臂车且句苣沮桔据蛆趄锔冯并屏甾载沓遢拓嗒踏同侗垌峒恫通令呤侧厕写叶邪契鲑夹伽茄家贾假葭脉炜哕虺咔咯卡估汩谷骨蛄雇毂嘏鹘叨陶焘角侥觉校教矫脚徼嚼可坷折蜇褚褶螫舍拾蛇歙畬号好貉弹澹歪崴炀烊鞅奔贲头宁拧主术助柱庶属归龟柜炅桧鳜呷咖嘎尼伲泥嶷作笮壳峤悄雀翘劁谯蕉鞘红哄蕻氐坻的嘀镝地底得撇佣喁汗犴含感县券眩旋呱佃点钿呗陌削噱嚷穰郇荨熏窨潭鸟溺弄泷笼乘秤称盛裎澄蹬艮孱禅占粘辗颤仰会浍伧嗔冲虫重涌观串纶冠矜莞兴省夯行炕肮巷浚隽菌筠当挡铛咧裂创厌芫阽咽研剡殷铅阏腌燕圩浒砉畜嘘侯率绿囝南难胗振椹僮幢戆臭宿择责祭翟尿隋遂睢祝轴调舳粥倩綮鲭栝扫燥拉剌喇腊蜡啦莩票嘌漂缥杉沙刹奢厦嗄煞噎镩汤倘惝铴樘趟镗拚娉牟泌咪秘眯谜糜靡否姥唠涝落潦獠肋勒累雷嘞漯擂儡思塞色酾芍炔阙肚读都渎驮垛度堕桁珩横呐呢忪过娜旁榜磅凉量靓踉体荑绨提裼醍俶佛免渑棱楞别瘪临啉淋亲覃溱廑囤沌敦镦蹲吭吵剿爪啁着朝嘲皋膏镐呛抢戗跄强镪降将椎缪噌苦应荥忒褪挝涡娆荛更绠杓骠苕挑来徕癞焯琢缴躅枞晃慌苴这丧柴刷卒趣蹴哈虾蛤呶咀觜氓黾蒙帖莎挲缩拆嚓迫派排浑荤珲混络捋烙硌跞啰玢槟育哟喏若拽喋揲昳莨偻喽搂露奘脏臧藏俩拶攒哏蚌绷喷掊瘥撮叟擞哦埋谩蔓嫚啐粹棍谁麇钻赚揣嘬啜绰嘚综曾缯嗨嘿嗯囊馕"
}

View File

@ -1 +0,0 @@
["b", "p", "m", "f", "d", "t", "n", "l", "g", "k", "h", "j", "q", "x", "zh", "ch", "sh", "r", "z", "c", "s", "y", "w"]

View File

@ -1,174 +0,0 @@
"use strict";
var _require = require('./compareSpell'),
initToneCodes = _require.initToneCodes,
getCharCode = _require.getCharCode;
var _cnchar = null;
var arg = {
'tone': 'tone',
'desc': 'desc',
'array': 'array'
};
function initSort(__cnchar) {
_cnchar = __cnchar;
initToneCodes(__cnchar);
}
var TYPE = {
MORE: 'more',
// 大于
LESS: 'less',
// 小于
EVEN: 'even',
// 等于
ERROR: 'error'
};
function pretreat(spell, tone) {
var arr = ['low'];
if (tone) {
arr.push('tone');
}
if (_cnchar.isCnChar(spell)) {
var _cnchar2;
return (_cnchar2 = _cnchar).spell.apply(_cnchar2, [spell].concat(arr));
}
return _cnchar._.transformTone(spell, tone).spell;
}
function compareSpell(spell1, spell2) {
var tone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
spell1 = pretreat(spell1, tone);
spell2 = pretreat(spell2, tone);
for (var i = 0; i < spell1.length; i++) {
if (!spell2[i]) {
// spell1与spell2值前面拼音一样但是spell1长度大于spell2 说明 spell1 > spell2
return TYPE.MORE;
}
var code = getCharCode(spell1[i], tone);
var code2 = getCharCode(spell2[i], tone);
if (code > code2) {
// spell1 > spell2
return TYPE.MORE;
} else if (code < code2) {
// spell1 < spell2
return TYPE.LESS;
}
}
if (spell1.length === spell2.length) {
return TYPE.EVEN;
}
return TYPE.LESS; // spell1与spell2值前面拼音一样但是spell1长度小于spell2 说明 中 < spell2
}
function sortSpell(spells) {
var isString = false;
if (typeof spells === 'string') {
spells = spells.split('');
isString = true;
}
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var tone = args.indexOf(arg.tone) !== -1;
var desc = args.indexOf(arg.desc) !== -1;
var more = desc ? -1 : 1;
var less = more * -1;
var result = spells.sort(function (a, b) {
var res = compareSpell(a, b, tone);
if (res === TYPE.MORE) {
return more;
}
if (res === TYPE.LESS) {
return less;
}
return 0;
});
if (isString) {
return result.join('');
}
return result;
}
function compareStroke(stroke1, stroke2) {
if (typeof stroke1 === 'string') {
stroke1 = _cnchar.stroke(stroke1);
}
if (typeof stroke2 === 'string') {
stroke2 = _cnchar.stroke(stroke2);
}
if (stroke1 > stroke2) {
return TYPE.MORE;
}
if (stroke1 < stroke2) {
return TYPE.LESS;
}
return TYPE.EVEN;
}
function sortStroke(strokes) {
var isString = false;
if (typeof strokes === 'string') {
strokes = strokes.split('');
isString = true;
}
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
var desc = args.indexOf(arg.desc) !== -1;
var more = desc ? -1 : 1;
var less = more * -1;
var result = strokes.sort(function (a, b) {
var res = compareStroke(a, b);
if (res === TYPE.MORE) {
return more;
}
if (res === TYPE.LESS) {
return less;
}
return 0;
});
if (isString) {
return result.join('');
}
return result;
}
module.exports = {
sortSpell: sortSpell,
sortStroke: sortStroke,
initSort: initSort,
compareSpell: compareSpell,
compareStroke: compareStroke
};

View File

@ -1,43 +0,0 @@
{
"的": "de",
"咳": "ké",
"长": "cháng",
"广": "guǎng",
"厂": "chǎng",
"卜": "bo",
"无": "wú",
"蔚": "wèi",
"压": "yā",
"扎": "zhā",
"教": "jiāo",
"觉": "jiào",
"虎": "hǔ",
"熏": "xūn",
"陶": "táo",
"子": "zǐ",
"脯": "fǔ",
"抹": "mā",
"食": "shí",
"鸟": "niǎo",
"任": "rèn",
"假": "jiǎ",
"得": "de",
"膀": "bǎng",
"塞": "sāi",
"红": "hóng",
"区": "qū",
"帖": "tiē",
"提": "tí",
"汤": "tāng",
"沓": "tà",
"悄": "qiāo",
"落": "luò",
"分": "fēn",
"处": "chù",
"绿": "lǜ",
"累": "lèi",
"辟": "bì",
"苦": "kǔ",
"被": "bèi",
"厕": "cè"
}

View File

@ -1,409 +0,0 @@
{
"ai": "0:艾9哎1哀1诶1唉9唉6埃1挨7挨6爱4砹4捱2皑2隘4嗌9嗳9嗳8嗳6嫒4矮3碍4暧4瑷4蔼3锿1噫9癌2霭3娭6",
"yi": "1:一1乙3义7义9亿4已3弋4刈4忆4艺4仡9以3仪2艾9议4亦4伊1圯2夷2屹4异4衣1钇3佚4医1呓4尾8役4抑4沂2矣3苡3译4诒2邑4佾4依8依6宜2峄4怡2怿4易4绎4诣4迤2饴2驿4咦2咿1奕4姨2弈4疫4羿4舣3荑7蚁3贻2轶4食9倚3悒4挹4益4眙2胰2谊4酏3埸4猗1痍2移2翊4翌4蛇7逸4铱1壹1揖1椅8椅6遗7嗌9意4溢4缢4肄4蛾8裔4颐2旖3漪1疑2瘗4蜴4毅4熠4镒4劓4噫9噫6殪4薏4嶷7翳4翼4臆4彝2癔4镱4黟1懿4祎1燚4昳9乂4",
"ding": "1:丁6仃1订4叮1玎1町6疔1盯1钉9钉6定4耵1顶3酊8酊6啶4铤9腚4鼎3碇4锭4奵3",
"zheng": "2:丁6正9正6争9争6证4征1怔9怔6诤9诤6郑4峥1拯3挣9挣6政9政6狰1症9症6钲1睁1铮9铮6筝1蒸1整3鲭6",
"qi": "1:七1丌2乞3亓2气4讫4企3屺3岂3汔4祁2芑3迄4齐7启3圻7岐2弃4杞3汽4沏1芪2亟9其7奇7妻9妻6歧2泣4祈2俟7契9柒1砌9荠7凄1栖6桤1耆2脐2起3颀2啐5崎2戚1淇2畦2绮3萁2萋1骐2骑2期1棋2欹1欺1琦2琪2祺2缉6葺4蛴2碛4嘁1旗2槭4漆1綦2綮8蜞2稽8蕲2器4憩4蹊6鳍2麒2碁2埼2祇2啟3",
"nai": "1:乃3奶3艿8氖3佴9奈4哪8柰4耐4萘4鼐4",
"mie": "2:乜6灭4咩1蔑4篾4蠛4",
"nie": "2:乜9陧4捏1涅4聂4臬4啮4捻6嗫4镊4镍4颞4蹑4孽4蘖4",
"jiu": "2:九3久3旧4纠1臼4灸3玖3究1鸠1咎4疚4柩4赳1韭3桕4酒3阄1厩4救4啾1就4揪1湫6舅4僦4鹫4蹴5鬏1",
"le": "1:了5仂4乐9叻4肋6泐4勒9嘞6鳓4簕4玏4饹5",
"liao": "2:了8辽2尥4疗2钌9钌8料4聊2僚2寥2廖4撂4蓼8嘹2寮2撩7撩9撩8撩6潦7獠7缭2燎7燎9燎8镣4鹩2瞭9瞭8",
"er": "0:二4儿2尔3而2耳3佴9迩3洱3贰4饵3珥3铒9铒8鸸2鲕2",
"ren": "1:人2亻2刃4仁2壬2认4仞4任7任9纫4妊4忍3轫4韧4饪4荏3衽4葚9稔3",
"ru": "1:入4如2汝3乳3洳4茹2辱3铷2溽4缛4蓐4褥4儒2嚅2孺2濡2薷2襦2蠕2颥2",
"fan": "1:凡2反3犯4帆1泛4返3饭4矾2范4贩4钒2畈4烦2袢7梵4番6幡1樊2蕃6蕃7燔2繁7翻1藩1蹯2蘩2璠2",
"po": "1:叵3朴9朴6钋1陂6坡1泊6泼1迫9珀4破4钷3婆2笸3粕4颇1鄱2魄9皤2繁7",
"bo": "1:伯7孛7驳2帛2拨1泊7波1勃2柏7柏9玻1亳2剥6般6趵6钵1钹2铂2饽1啵5啵6脖2舶2菠1博2渤2跛3鹁2搏2鲅6箔2膊5膊7魄7播1蕃6踣2薄7薄9擘4檗4簸9簸8礴2卜5僰2",
"pa": "1:叭6扒7帕4怕4杷7爬2派6趴1耙7啪1琶2葩1筢2",
"ba": "1:八1巴1叭9叭6伯9吧6坝4岜1把8把9芭1拔2杷9爸4茇2疤1钯3捌1笆1粑1罢9耙9菝2跋2靶9靶8鲅9魃2霸4灞4扒6吧5罢5",
"jiong": "2:冂1炅8迥3扃1炯3窘3囧3",
"gei": "1:给8",
"xi": "1:习2夕1兮1戏9汐1西1吸1希1系9饩4昔1析1矽1穸1细4郄4洗8茜6郗1唏1奚1席2息1栖6浠1牺1玺3徙3悉1惜1欷1淅1烯1硒1菥1袭2觋2铣8阋4喜3晰1犀1稀1粞1翕1腊6舄4舾1葸3隙4媳2溪1皙1禊4裼6锡1僖1屣3熄1熙1蓰3蜥1嘻1嬉1膝1樨1歙6熹1禧3羲1螅1褶7隰2檄2蟋1蹊6醯1曦1鼷1晞1窸1潟4娭6囍3",
"ji": "1:辑2箕1几8几6己3及2计4讥1击1叽1记4饥1乩1伎4吉2圾1岌2机1汲2玑1级2纪9纪8肌1芨1齐9即2妓4忌4技4极2矶1系9芰4际4鸡1亟7佶2其6剂4奇6季4虮3咭1哜4急2挤3既4洎4济9济8笈2给8荠9迹4革7剞1唧1姬1屐1疾2积1笄1继4脊3觊4偈9基1寂4寄4悸4掎3祭9绩4嵇1戟3戢2棘2殛2犄1缉6赍1集2嫉2嵴2楫2畸1蒺2蓟4跻1麂3暨4跽4霁4鲚4畿1瘠2稷4稽6蕺2鲫4齑1冀4墼1激1髻4羁1藉7骥4籍2鱀4錤1漈4",
"kan": "1:凵3刊1坎3侃3看9看6砍3莰3龛1勘1堪1戡1槛8阚4瞰4磡4",
"dao": "1:刀1叨6忉1导3氘1岛3到4倒8倒9帱9捣3悼4焘9盗4祷3道4稻4蹈3纛4捯2",
"diao": "2:刁1叼1鸟8吊4钓4凋1调9掉4铞4铫9貂1碉1雕1鲷1屌3",
"li": "1:力4历4厉4礼3立4吏4丽7丽9利4励4呖4坜4李3沥4苈4里3例4戾4枥4疠4隶4俐4俚3俪4厘2栎9疬4荔4轹4郦4哩5哩6哩8娌3栗4梨2狸2猁4砺4砾4离2莅4莉4逦3骊2鬲9唳4犁2理3笠4粒4粝4蛎4傈4喱2痢4詈4跞9锂3雳4鹂2溧4漓2缡2蓠2蜊2嫠2璃2鲡2鲤3黎2澧3篥4篱2罹2藜2醴3黧2蠡7蠡8鳢3琍2栃4",
"pao": "1:刨7抛1咆2庖2泡9泡6狍2炮9炮7疱4袍2匏2脬1跑7跑8",
"bao": "1:勹1包1刨9报4孢1宝3抱4苞1饱3保3炮6胞1鸨3剥6豹4趵9堡8葆3煲1雹2鲍4龅1褓3暴9褒1薄7瀑9曝9爆4",
"bi": "1:匕3币4比3必4毕4闭4吡8妣3庇4芘9彼3泌9畀4哔4毖4秕3荜4贲9陛4俾3毙4狴4秘9笔3舭3荸2铋4婢4庳4敝4萆4弼4愎4筚4逼1滗4痹4睥9蓖4裨9跸4辟9鄙3弊4碧4箅4蔽4鼻2壁4嬖4篦4薜4避4濞4臂9髀4璧4襞4",
"can": "1:灿4参6残2蚕2惨3惭2掺9骖1孱9粲4餐1璨4黪3",
"shen": "2:什7申1伸1沈3身1参6呻1审3绅1肾4诜1哂3甚7甚9矧3神2胂4娠1砷1莘6谂3婶3深1渖3渗4葚9慎4椹9蜃4糁6燊1珅1屾1榊0",
"shi": "2:十2士4尸1什7氏9世4仕4史3失1市4矢3石7示4师1式4似9时2识7豕3事4使3侍4势4始3实2虱1视4试4诗1饰4驶3室4屎3峙9恃4拭4拾7施1是4柿4炻2狮1蚀2贳4适4食7埘2舐4莳7莳9轼4逝4铈4匙5弑4殖5湿1谥4释4嗜4筮4蓍1嘘6誓4酾6鲥2噬4鲺1螫9奭4",
"guang": "2:广8光1犷3咣1桄9桄6胱1逛4洸1",
"an": "0:厂6广6安1犴9岸4按4俺3案4桉1氨1胺9埯3庵1谙1铵3揞3暗4鹌1鞍1黯4垵3",
"zhang": "2:丈4仉1长8仗4帐4张9张6杖4胀4账4涨8涨9章1掌3鄣1障4嫜1嶂4幛4彰1漳1獐1樟1璋1瘴4蟑1",
"chang": "2:厂8长7伥1场7场8怅4肠2苌2昌1畅4尝2昶3倘7倡9倡6鬯4偿2唱4娼1常2徜2惝8猖1菖1阊1敞3嫦2裳7氅3鲳1",
"cha": "2:叉7叉9叉8叉6汊4岔4杈9杈6刹9衩8衩9诧4咤9姹4差9差6查7茬2茶2喳6插1搽2猹7馇1楂7槎7察2碴7碴6锸1嚓6檫2镲3査2剎4",
"ci": "1:次4此3伺9词2刺9刺6兹7呲1差6祠2茈7茨2瓷2疵1赐4慈2辞2磁2雌2鹚2糍2",
"si": "1:厶1巳4丝1司1四4寺4死3汜4伺9似9兕4姒4祀4私1厕5咝1泗4饲4驷4俟9思6食9鸶1笥4耜4斯1缌1蛳1嗣4肆4厮1锶1嘶1撕1澌1偲6",
"you": "1:又4尢7友3尤2右4幼4由2优1有8有9佑4卣3忧1攸1犹2邮2酉3侑4呦1油2囿4宥4幽1柚7柚9疣2诱4莜2莠3莸2铀2悠1蚰2蚴4铕3游2釉4鱿2猷2牖3蝣2蝤7繇7黝3鼬4祐4",
"mei": "1:每3没7妹4枚2玫2昧4眉2美3袂4浼3莓2梅2谜9媒2媚4寐4嵋2湄2猸2楣2煤2酶2镁3镅2魅4鹛2霉2糜7",
"wan": "1:万9丸2纨2芄2完2宛3玩2弯1剜1挽3晚3莞8顽2婉3惋3烷2绾3脘3菀8湾1琬3皖3腕4畹3碗3蔓9蜿1豌1",
"mo": "1:万8无7末4没9抹9抹8殁4沫4茉4陌9冒9脉9秣4莫9袜9谟2嫫2寞4摸1漠4蓦4貊4馍2摹2模7膜2麽2嘿9墨4摩7瘼4镆4磨7磨9默4嬷2貘4蘑2魔2耱4",
"san": "1:三1伞3叁1参6散9散8毵1糁8馓3",
"shang": "2:上9上8伤1汤6尚4垧3殇1晌3商1绱4觞1赏3墒1熵1裳5",
"ge": "1:个9个8戈1仡6各9各8合8圪1纥6疙1咯6虼4阁2革7哥1哿3格7格6胳7胳6鬲7盖8硌9舸3袼1铬4鸽1割1搁7搁6葛7葛8蛤7隔2嗝2塥2歌1搿2膈2镉2骼2饹6",
"ya": "1:丫1牙2疋3轧9亚4伢2压9压6厌6吖6讶4呀6岈2芽2迓4押1哑8哑6垭4娅4砑4鸦1桠1氩4琊2蚜2鸭1崖2涯2痖3揠4雅8雅6睚2衙2呀5",
"shuo": "3:妁4烁4说6朔4铄4硕4搠4蒴4槊4",
"tuo": "2:讬1乇1托1驮7佗7佗6妥3陀2坨2拓9拖1沱2驼2柁2柝4说6砣2鸵2唾4庹3脱1椭3跎2酡2箨4魄9橐2鼍2託1",
"me": "1:么0",
"ye": "1:也3业4叶9曳4爷2邪7页4冶3邺4夜4耶7耶6咽9拽9晔4烨4掖9掖6揶2液4谒4野3铘2椰1腋4噎6靥4",
"xiang": "2:乡1向4芗1享3详2降7响3巷9庠2相9相6项4饷3香1祥2厢1象4湘1缃1翔2葙1飨3像4想3鲞3橡4箱1蟓4襄1骧1镶1",
"chu": "2:亍4出1刍2处8处9初1助7怵4杵3绌4除2畜9础3储3厨2楮3滁2锄2搐4楚3蜍2褚8触4雏2樗1憷4橱2黜4躇2蹰2矗4俶9岀1",
"yu": "1:于2与7与9与8予7予8肀4玉4驭4伛3吁9吁6宇3屿3纡1羽3聿4芋4迂1余2妤2妪3欤2汩9谷9饫4於6盂2育9臾2郁4雨9雨8鱼2俞2俣3昱4狱4禹3禺7禺9竽2舁2语9语8圄3娱2峪4浴4狳2谀2钰4预4馀2圉3域4尉9庾3欲4淤1渔2菀9菸1萸2谕4阈4隅2雩2喁7喻4寓4嵛2御4愉2揄2渝2粥9腴2裕4逾2遇4鹆4愈4愚2榆2煜4瑜2瘀1瘐3蓣4虞2觎2誉4毓4窬2舆2蔚9蜮4熨9窳3蝓2豫4龉3燠4鹬4鬻4彧4畬7瑀3玙2堉4",
"kui": "2:亏1归9岿1奎2悝1傀3匮4盔1逵2隗7馗2喟4喹2愦4愧4揆2溃4葵2蒉4馈4暌2窥1跬3魁2睽2篑4聩4蝰2夔2",
"wang": "1:亡7尢6王7王9妄4网3忘4汪1往3旺4枉3罔3惘3望4辋3魍3",
"wu": "1:亡7兀9兀6乌9乌6五3勿4午3无7毋2务4戊4阢4仵3伍3圬1污1邬1吴2吾2呜1坞4妩3庑3忤3怃3杌4芜2芴9迕3巫1於6武3物4侮3屋1诬1误4钨1唔2恶9恶6悟4捂3梧2浯2晤4焐4牾3婺4痦4骛4蜈2雾4鹉3寤4舞3鹜4鋈4鼯2鹀2",
"shao": "2:勺2少3芍7劭4杓7邵4绍4苕7哨4捎9捎6梢1烧1稍9稍6筲1艄1蛸6韶2潲4鞘6",
"qian": "2:千1欠9欠5仟1阡1扦1纤9芊1迁1佥1岍1芡4浅8肷3钎1前2牵1茜9荨7钤2倩9悭1虔2钱2钳2铅6乾2堑4掮2嵌4椠4犍7谦1愆1慊9签1遣3骞1搴1歉4箝2潜2谴3缱3褰1黔2",
"wei": "1:卫4囗2为7为9韦2未4伟3伪3危1圩7位4围2尾8帏2沩2纬3苇3违2闱2味4委8委6炜8玮3威1洧3畏4胃4娓3桅2涠2诿3軎4偎1唯2尉9帷2惟2维2萎3谓4逶1隈1隗8喂4崴6嵬2渭4猥3猬4葳1遗9微1煨1痿3艉3韪3潍2蔚9鲔3慰4薇1魏4巍1韡3暐3",
"kou": "1:口3叩4扣4抠1芤1眍1寇4筘4蔻4",
"tu": "1:土3凸1吐9吐8秃1兔4图2钍3突1徒2涂2荼7途2堍4屠2菟7菟9酴2",
"da": "1:大9打7打8达2妲2怛2沓7哒1耷1惮7笪2搭1答7答6嗒6瘩7褡1靼2鞑2疸5瘩5跶2",
"dai": "1:大9歹3代4呆1呔6岱4甙4绐4迨4骀9带4待9待6怠4殆4玳4贷4埭4袋4逮9逮8傣3戴4黛4",
"nü": "1:女3钕3恧4衄4",
"zi": "1:子9子8仔8仔6字4自4吱6姊3孜1甾6兹6咨1姿1秭3籽3耔3茈8恣4笫3赀1资1梓3淄1渍4眦4缁1谘1孳1嵫1滋1粢1紫3辎1滓3觜6訾8訾6趑1锱1龇1髭1鲻1孖6嗞1",
"jie": "2:孑2介4节7节6讦2价5价9阶1劫2戒4疖1芥9姐3届4杰2诘2拮2洁2界4疥4皆1结7结6诫4借4家5桀2桔7蚧4偈7婕2捷2接7接6秸1喈1嗟1揭1街1颉2楷6睫2解9解8骱4截2碣2竭2鲒2羯2藉9劼2毑3堺4",
"jue": "2:孓2决2诀2抉2角7珏2绝2觉7倔7倔9崛2掘2桷2脚7觖2厥2阙7劂2谲2噘1撅1獗2蕨2噱7橛2爵2镢2蹶2嚼7矍2鳜7爝2攫2",
"cun": "1:寸4存2忖3村1皴1蹲7邨1",
"xiao": "2:小3孝4肖9肖6枭1削6哓1枵1骁1哮4宵1效4晓3校9消1笑4绡1逍1啸4崤2淆2萧1硝1销1筱3蛸6潇1箫1霄1魈1嚣6咲4鸮1",
"chuan": "3:巛1川1传7舛3串9氚1钏4穿1舡2船2喘3遄2椽2",
"gong": "1:工1廾3弓1公1功1共9共8共6巩3红6攻1汞3贡4供9供6肱1宫1拱3恭1珙3蚣1躬1龚1觥1赣9斤1",
"jin": "1:巾1仅9仅8今1钅1尽9尽8劲9妗4近4进4卺3金1津1矜6荩4衿1晋4浸4烬4紧3赆4堇3筋1缙4禁9禁6谨3锦3靳4廑8馑3槿3瑾3觐4噤4襟1浕4琎1",
"gan": "1:干9干6甘1奸6旰4杆8杆6肝1坩1泔1矸1秆3绀4苷1柑1竿1疳1赶3酐1敢3淦4尴1感8澉3橄3擀3赣9",
"nüe": "2:疟9虐4",
"yao": "1:幺1夭6爻2吆1尧2约6妖1侥7杳3疟9肴2咬3姚2荛7药4要9要6轺2钥9珧2窈3舀3陶7窑2铫7崾3谣2徭2摇2腰1遥2瑶2鹞4徼6邀1繇7曜4鳐2耀4垚2",
"cai": "1:才2材2财2采9采8彩3猜1菜4裁2睬3蔡4踩3採3偲6",
"fa": "1:乏2发6发9伐2法3垡2珐4罚2阀2砝3筏2",
"fei": "1:飞1发9妃1吠4芾9废4怫9沸4狒4肥2肺4非1费4匪3诽3啡1悱3淝2绯1菲8菲6扉1斐3腓2痱4榧3翡3蜚8蜚6镄4篚3霏1鲱1",
"ma": "1:马3吗7吗8妈1犸3杩4玛3抹6码3蚂9蚂8蚂6骂4唛4麻7麻6摩6蟆2吗5嘛0孖6",
"bu": "1:不4卟3布4步4补3怖4钚4哺3埔9捕3逋1部4钸1埠4晡1堡8瓿4簿4醭2卜8咘4埗4佈4",
"gai": "1:丐4改3芥9该1陔1垓1钙4赅1盖9溉4戤4概4",
"chou": "2:丑3仇7抽1俦2帱7臭9惆2绸2畴2愁2稠2筹2酬2瞅3踌2瘳1雠2",
"zhuan": "3:专1传9沌9转9转8砖1啭4赚9撰4篆4颛1馔4",
"zhong": "2:中6中9仲4众4忪6忠1终1肿3盅1种9种8重9钟1冢3舯1衷1锺1踵3螽1塚3",
"feng": "1:丰1凤4风9风8风6冯7讽3沣1奉4枫1封1疯1砜1俸4峰1逢2唪3烽1葑9葑6锋1缝7缝9蜂1酆1峯1",
"dan": "1:丹1旦4石9但4单6担9担6诞4眈1胆3疸8耽1郸1啖4弹9惮9掸8淡4聃1萏4蛋4殚1氮4赕3瘅9瘅6箪1儋9儋6澹9疍4",
"shan": "2:山1讪4闪3汕4删1杉6芟1单9姗1疝4苫9苫6衫1钐9钐6陕3栅6珊1舢1剡9扇9扇6掸9掺8掺6善4禅9跚1骟4煽1鄯4潸1缮4嬗4擅4膳4膻1赡4蟮4鳝4",
"zhi": "2:之1支1止3氏6卮1只8只6汁1执2旨3至4芝1吱6址3志4忮4纸3芷3识9豸4侄2制4帙4帜4枝1治4炙4直2知1祉3织9织6肢1质4郅4咫3峙9指3枳3栀1栉4祗1胝1轵3陟4值2挚4桎4秩4脂1致4贽4轾4埴2掷4痔4窒4职2趾3鸷4彘4智4植2殖7滞4痣4絷2蛭4跖2骘4黹3稚4置4酯3雉4摭2蜘1徵3膣4觯4踬4踯2製4",
"shu": "2:书1殳1术9戍4抒1束4纾1叔1枢1沭4述4姝1树4竖4倏1恕4殊1秫2荼6孰2庶9梳1淑1菽1属8暑3疏1舒1赎2黍3摅1数9数8毹1署3腧4输1鼠3塾2墅4漱4蜀3澍4熟7蔬1薯3曙3",
"yun": "1:云2允3匀2孕4员7员9狁3纭2芸7芸9运4昀2郓4恽4郧2陨3晕9晕6耘2殒3酝4愠4氲1筠7韫4韵4熨9蕴4赟1鋆2贇1",
"xia": "2:下4吓9匣2侠2呷6狎2峡2柙2狭2虾6夏4假7唬9硖2厦9葭7遐2暇2瑕2辖2瞎1罅4霞2黠2",
"he": "1:禾2合7吓9纥7何7何9诃1劾2呵6和7和9河2曷2贺4阂2害7核7盍2荷7荷9涸2盒2菏2喝6喝9颌2鹄9嗬1貉7阖2褐4赫4鹤4翮2壑4龢2饸2",
"hu": "1:互4户4乎1冱4戏6虍1囫2护4沪4芴6呼1和7岵4弧2忽1怙4戽4狐2虎9虎8浒8烀1祜4胡2轷1壶2核7笏4唬8唿1惚1扈4斛2瓠4湖2猢2琥3葫2雇9鹄7煳2瑚2滹1鹕2鹘7槲2糊7糊9糊6蝴2醐2觳2鹱4鄠4",
"jing": "1:井3阱3刭3劲9京1净4弪4径9径6泾1经9经6肼3茎1迳4胫4荆1痉4竞4婧4惊1旌1竟4菁1敬4景3晶1腈1靓9睛1粳1靖4儆3兢1境4獍4精1静4憬3镜4鲸1警3璟3",
"kang": "1:亢4伉4扛7抗4闶4炕9钪4康1慷1糠1",
"ze": "1:仄4则2侧9咋7择7昃4泽2责7迮2啧2帻2笮7舴2箦2赜2",
"pu": "1:仆7仆6攴1攵1扑1朴8匍2圃3埔8浦3莆2脯7菩2堡9普3葡2铺9铺6溥3蒲2谱3噗1暴9氆3璞2濮2镤2镨3瀑9曝9蹼3",
"qiu": "2:仇7丘1囚2犰2求2虬2邱1龟6泅2俅2秋1酋2逑2球2蚯1赇2巯2湫6遒2楸1裘2蝤7糗3鼽2鳅1萩1",
"reng": "1:仍2扔1艿9",
"cong": "1:从2丛2匆1囱1苁1枞6淙2琮2葱1骢1璁1聪1",
"lun": "1:仑2伦2论7论9囵2抡7抡6沦2纶7轮2",
"cang": "1:仓1伧6沧1苍1舱1臧7藏7",
"yuan": "2:元2员7园2沅2芫7远3苑4鸢1垣2怨4爰2院4冤1原2圆2垸4眢1袁2鸳1渊1媛7媛9掾4援2缘7缘9鼋2塬2源2猿2瑗4愿4箢1辕2圜7橼2螈2贠2",
"liu": "2:六9刘2陆9柳3浏2流2留2琉2绺3硫2锍3旒2溜9溜6碌9遛7遛9馏7馏9骝2榴2熘1瘤2镏7镏9鹨4鎏2",
"lu": "1:六9卢2卤3庐2芦2陆9垆2录4泸2炉2虏3栌2胪2轳0赂4辂4鸬2掳3渌4绿9舻2逯4颅2鹿4禄4鲁3碌9路4鲈2漉4蓼9噜1戮4撸1辘4橹3氇0潞4璐4簏4镥3鹭4麓4露9勠4蕗4甪4",
"na": "1:内9那9那6呐9纳4肭4南6哪9哪8娜9衲4钠4拿2捺4镎2",
"nei": "1:内9那9哪8馁3",
"gang": "1:冈1刚1扛6岗9岗8岗6杠9杠6纲1肛1缸1钢9钢6罡1港3筻4戆9",
"rong": "1:冗3戎2肜2狨2绒2茸2荣2容2嵘2溶2蓉2榕2熔2蝾2融2镕2",
"xiong": "2:凶1兄1匈1芎1汹1胸1雄2熊2",
"fen": "1:分9分6份4吩1坟2汾2纷1芬1奋4忿4氛1玢6粉3偾4酚1愤4棼2焚2粪4鲼4鼢2瀵4棻1",
"qie": "2:切9切6且8伽7妾4怯4茄7砌9窃4挈4惬4慊9箧4锲4趄9",
"juan": "2:卷9卷8倦4娟1捐1桊4涓1狷4绢4隽9圈9圈6眷4鄄4鹃1锩3镌1蠲1劵4",
"quan": "2:劝4犬3全2权2券9卷7诠2泉2畎3荃2悛1拳2辁2圈6痊2绻3铨2筌2蜷2醛2鬈2颧2圏1佺2",
"ban": "1:办4半4阪3伴9坂3扮4扳6拌9板3版3绊4钣3班1舨3般6颁1斑1搬1瘢1癍1瓣4",
"gou": "1:勾9勾6句6佝1沟1岣3构4狗3苟3诟4购4垢4枸8枸6钩1够4笱3缑1媾4彀4遘4觏4篝1鞲1",
"hua": "2:化9化6划7划9华7华9华6花1画4话4哗7哗6砉6骅2桦4铧2滑2猾2鲑7嬅4",
"pi": "1:匹3丕1庀3皮2仳3圮3吡8否8屁4批1纰7纰6芘7邳1陂7坯1披1枇2毗2砒1疲2蚍2被6郫2铍7铍6陴2啤2埤7埤9淠4琵2痞3脾2媲4睥9裨7辟9罴2蜱2僻4劈8劈6噼1擗3甓4貔2癖3譬4霹1鼙2",
"ou": "0:区6讴1呕3怄4沤9沤6欧1殴1瓯1鸥1偶3耦3藕3",
"qu": "1:区6去4曲8曲6劬2岖1苣8诎1驱1取3屈1朐2祛1鸲2娶3渠2蛆6躯1蛐1趋1阒4蕖2觑4趣9磲2璩2龋3瞿2蘧2麴1黢1氍2癯2衢2蠼2",
"sa": "1:卅4仨1洒3飒4脎4萨4撒8撒6",
"sheng": "2:升1圣4生1声1牲1省8胜4乘9晟4眚3渑7盛9笙1绳2剩4甥1嵊4昇1陞1",
"bian": "2:卞4弁4边1忭4汴4苄4贬3便9变4扁8砭1窆3匾3笾1缏9编1遍4煸1碥3褊8蝙1辨4辩4辫4鳊1鞭1釆4",
"pian": "2:片9片6便7扁6骈2胼2偏1谝3缏7骗4犏1褊7篇1翩1蹁2",
"a": "0:吖6阿6阿9阿8呵6啊6啊7啊8啊9腌6锕1嗄7呵5啊5",
"e": "0:厄3讹2扼3苊3阿6轭3俄2垩3哦7娥2婀1屙1峨2恶9恶8胺8莪2饿3谔3鄂3阏8愕3萼3遏3锇2鹅2腭3蛾7锷3鹗3颚4额2噩3鳄3呃4噁2",
"ting": "1:厅1汀1廷2听1町6亭2庭2挺3烃1莛2梃9梃8停2铤8婷2艇3葶2蜓2霆2珽3",
"shuang": "3:双1泷6爽6爽8霜1孀1",
"tian": "2:天1田2佃7忝3恬2殄3畋2钿7掭4添1甜2腆3嗔7填2阗2舔3湉2畑2",
"tai": "1:太4台7台6呔8汰4邰2态4抬2肽4苔7苔6骀7炱2胎1钛4泰4酞4跆2鲐2薹2",
"fu": "1:呒3夫7夫6父9父8讣4付4弗2伏2凫2妇4负4佛7呋1孚7孚6扶2抚3甫3芙2芾7附4咐4府3怫7拂2拊3斧3服7服9绂2绋2肤1苻2阜4驸4俘2复4氟2祓2罘2茯2赴4郛2俯3浮2砩2莩7蚨2釜3副4匐2桴2涪2符2脯8艴2菔2袱2趺1辅3麸1傅4富4幅2稃1腑3赋4跗7跗6滏3福2缚4腹4蜉2辐2鲋4孵1腐3赙4幞2敷1蝠2蝮4鳆4黻2覆4馥4黼3頫3巿2復4",
"ao": "0:夭8凹1岙4坳4拗9拗8袄3敖2傲4奥4媪3嗷2廒2獒2遨2骜4熬7熬6澳4懊4翱2聱2螯2嚣7鏊4鳌2鏖2",
"kong": "1:孔3空6空9空8倥1恐3崆1控4箜1",
"yin": "1:尹3引3印4因1阴1吟2吲3圻7饮9饮8茚4垠2姻1洇1胤4茵1荫4音1殷6氤1狺2蚓3寅2淫2铟1银2隐3喑1堙1鄞2夤2窨9龈2瘾3霪2",
"che": "2:尺8车6彻4扯3坼4砗1掣4撤4澈4",
"chi": "2:尺8叱4斥4吃1弛2池2驰2赤4迟2饬4侈3坻7茌2齿3持2炽4哧1翅4耻3蚩1鸱1匙7敕4眵1笞1豉3啻4傺4嗤1媸1痴1墀2瘛4褫3踟2篪2螭1魑1呎3",
"tun": "1:屯7氽3吞1囤7饨0豚2褪9暾1臀2",
"zhun": "2:屯6肫1窀1准3谆1",
"hai": "1:亥4还7咳7咳6孩2骇4害9氦4海3胲3嗨6骸2醢3",
"huan": "2:幻4欢1奂4还7环2郇7宦4洹2唤4换4桓2浣4涣4眩9患4焕4萑2逭4痪4缓3豢4漶4锾2鲩4圜7寰2擐4缳2獾1鬟2鹮2嬛2",
"nian": "2:廿4年2念4拈1娘4埝4捻8粘7辇3鲇2蔫1辗8撵3碾3鲶2黏2",
"kai": "1:开1忾4凯3剀3垲3恺3铠3慨3揩1蒈3锎1楷8锴3闿3",
"xin": "1:心1囟4忻1芯9芯6辛1昕1欣1信4莘6衅4锌1新1歆1薪1镡2馨1鑫1炘1",
"shou": "2:手3守3收1寿4受4狩4首3兽4售4授4绶4瘦4熟7艏3",
"zha": "2:扎7扎6乍4札2轧7吒1诈4咋9咋6闸2咤9柞4查6栅9炸7炸9眨3哳1痄4砟3蚱4铡2喋7喳6揸1渣1猹6楂6槎9榨4蜡9齄1",
"za": "1:扎6匝1杂2咂1咋8拶6砸2",
"wen": "1:文2刎3问4免9吻3汶9纹2闻2紊3蚊2阌2温1雯2瘟1稳3璺4榅1",
"men": "1:门2们0扪2汶7闷6闷9钔2焖4懑4",
"dou": "1:斗9斗8抖3豆4钭3陡3蚪3读9逗4都6兜1渎9痘4窦4蔸1篼1吋4",
"fang": "1:方1仿8访3邡1防2坊7坊6妨2彷8纺3芳1房2放4枋1肪2钫1舫3鲂2昉3",
"ri": "1:日4",
"yue": "2:曰1月4乐9刖4约6岳4哕8栎9说9钥9悦4钺4阅4跃4粤4越4樾4龠4瀹4玥4戉4",
"mu": "1:木4仫4母3目4牟9亩3沐4牡3坶4姆3拇3牧4苜4姥8毪2莫9钼4募4墓4幕4睦4慕4模7暮4穆4",
"mao": "1:毛2卯3矛2峁3泖3牦2茂4茅2茆7茆8冒9昴3贸4旄7旄9耄4铆3猫7猫6袤4帽4瑁4锚2瞀4貌4髦2蝥2懋4蟊2冇3",
"shui": "3:水3说9谁7税4睡4",
"huo": "2:火3和9或4货4活2钬3获4祸4惑4耠1锪1夥3劐1霍4豁7豁9豁6镬4嚯4攉1藿4蠖4伙3伙5和7和5漷3",
"zhua": "3:爪8抓1挝6",
"pang": "1:乓1仿7彷7庞2胖9逄2旁7滂1膀7膀6磅7耪3螃2",
"pan": "1:爿2伴9判4扳6拌9拌6拚9泮4叛4盼4胖7畔4般7袢9盘2番6潘1磐2蹒2蟠2攀1襻4槃2",
"niu": "2:牛2妞1忸3扭3狃3纽3拗9钮3",
"wa": "1:瓦9瓦8佤3哇6娃2挖1洼1娲1袜9蛙1腽4哇5",
"jian": "2:见9戋1件4囝8奸6尖1坚1歼1间6间9建4拣3枧3浅6肩1艰1饯4俭3剑4柬3牮4茧3荐4贱4健4兼1捡3涧4监9监6笕3舰4减3剪3检3渐9渐6笺1菅1谏4趼3楗4毽4湔1溅9溅6犍6睑3硷3缄1腱4裥3践4锏9锏8搛1煎1简3缣1蒹1谫3鉴4键4僭4戬3槛9碱3箭4翦3踺4鲣1鹣1謇3蹇3鞯1",
"xian": "2:见9仙1先1纤6县9岘4氙1苋4闲2冼3弦2现4祆1线4贤2限4咸2宪4显3洗8涎2籼1险3娴2猃3莶1蚬3陷4掀1舷2衔2铣8馅4痫2筅3羡4鹇2嫌2献4腺4跣3跹1酰1锨1鲜8鲜6暹1藓3燹3霰4",
"bei": "1:贝4北3呗5孛9狈4邶4陂6卑1备4杯1背9背6钡4倍4悖4被9悲1惫4焙4辈4碑1碚4蓓4鹎1褙4臂5鞴4鐾4",
"ju": "1:矩3车6且6句9巨4讵4局2拒4苣9具4咀8居1拘1柜8沮9沮8炬4狙1苴6驹1举3枸8莒3钜4俱4倨4剧4桔7疽1惧4据9据6掬1菊2蛆6距4椐1犋4琚1趄6锔7锔6飓4榉3榘3裾1锯4雎1龃3窭4聚4屦4踞4橘2踽3遽4鞠1鞫1醵4焗2泃1",
"shuan": "3:闩1拴1栓1涮4",
"dui": "2:队4对4兑4怼4堆1敦9碓4憝4镦9",
"ping": "1:冯7平2乒1评2凭2坪2苹2俜1屏7枰2娉6瓶2萍2鲆2",
"bing": "1:丙3冰1并9并6兵1邴3秉3屏8屏6柄3炳3饼3病4绠8摒4禀3槟6昺3",
"dong": "1:东1冬1动4冻4侗9咚1岽1垌9峒9恫9栋4氡1洞4胨4胴4鸫1硐4董3懂3",
"zai": "1:仔8再4在4灾1甾6哉1宰3栽1载9载8崽3",
"ta": "1:沓5遢5遢9他1它1她1拓9沓9挞4闼4趿1铊1塔3嗒9塌1溻1榻4漯9踏9踏6獭3蹋4鳎3",
"tong": "1:仝2同7同9佟2彤2侗7侗8垌7峒7恫6恸4统3茼2捅3桐2砼2通9通6桶3铜2痛4童2筒3嗵1酮2僮7潼2瞳2曈2樋1",
"ling": "1:令7令9令8另4伶2灵2呤7呤9囹2岭3泠2苓2柃2玲2瓴2凌2铃2陵2棂2绫2羚2翎2聆2菱2蛉2领3棱7零2龄2鲮2酃2",
"lan": "1:兰2岚2拦2栏2烂4览3婪2揽3缆3阑2榄3滥4蓝2漤3罱3谰2澜2褴2懒3斓2篮2镧2",
"ran": "1:冉3苒3染3蚺2然2髯2燃2",
"ce": "1:册4侧9厕9恻4测4策4",
"xie": "2:写9写8叶7协2血3邪7些1泄4泻4绁4胁2卸4契9挟2屑4偕2斜2械4谐2亵4渫4谢4携2楔1歇1解9榍4榭4鲑7勰2撷2缬2蝎1鞋2廨4懈4獬4薤4邂4燮4瀣4蟹4躞4",
"jia": "2:加1甲3价9夹7夹6伽6佳1岬3茄6迦1郏2驾4架4枷1浃1珈1胛3荚2家6恝2痂1贾9贾8钾3假8假9戛2笳1袈1铗2葭6蛱2跏1颊2嫁4嘉1嘏8瘕3稼4镓1",
"mai": "1:劢4买3迈4麦4卖4脉9荬3埋7霾2",
"hui": "2:卉4汇4会9回2戏6灰1虫8讳4炜6诙1咴1哕9恢1挥1洄2浍9绘4茴2荟4虺8虺6诲4恚4悔3晖1桧9烩4珲6贿4堕6彗4晦4秽4喙4惠4缋4蛔2辉1毁3睢6慧4蕙4麾1徽1隳1蟪4翚1",
"ka": "1:卡8佧3咔8咔6咖6咯8胩3喀1",
"qia": "2:卡8洽4掐1袷1葜1髂4恰4",
"gu": "1:古3估9估6汩8诂3谷8呱6咕1固4姑1孤1沽1股3苦8故4牯3轱1骨8骨6家6罟3贾8钴3顾4鸪1崮4梏4牿4菇1菰1蛄8蛄6蛊3觚1辜1酤1雇9鹄8毂8毂6痼4锢4鼓3嘏8箍1鹘7鲴4臌3瞽3堌4",
"tao": "1:叨6讨3洮2逃2套4桃2涛1弢1绦1陶7啕2掏1淘2焘6萄2滔1韬1鼗2饕1",
"jiao": "2:叫4艽1交1角8佼3侥8郊1姣1娇1峤9挢3浇1狡3绞3茭1觉9饺3骄1校9胶1轿4较4教9教6皎3矫7矫8脚8铰3搅3椒1湫8焦1窖4蛟1剿8敫3跤1僬1酵4鲛1噍4蕉6徼9徼8徼6缴8礁1鹪1醮4嚼7嚼9滘4漖4藠4",
"ke": "1:可8可9克4壳7刻4呵6坷8坷6岢3苛1咳7客4恪4柯1珂1科1轲1疴1课4钶1氪4蚵1骒4棵1渴3缂4颏1嗑4溘4稞1窠1锞4颗1瞌1磕1蝌1髁1",
"zhe": "2:折7折6这9者3柘4哲2浙4着5辄2蛰2蜇7蜇6褚8谪2锗3摺2蔗4遮1磔2赭3褶8辙2鹧4螫6喆2",
"she": "2:叶9厍4舌2设4佘2折7社4舍8舍9拾9射4涉4奢6猞1蛇7赊1赦4揲7畲1慑4摄4滠4歙9麝4畬6",
"hao": "1:号9号7好8好9昊4郝3浩4皋7耗4蚝2毫2皓4嗥2蒿1貉7豪2镐9嚆1薅1嚎2壕2濠2颢4灏4",
"tan": "1:叹4坍1坛2忐3坦3昙2贪1炭4袒3谈2郯2钽3弹7探4毯3覃7摊1滩1痰2锬2碳4谭2潭7瘫1澹7檀2倓2怹1",
"wai": "1:外4歪8歪6崴8",
"yang": "1:央1仰8扬2羊2阳2杨2炀7炀9佯2怏4泱1疡2养3徉2殃1洋2恙4样4氧3烊7烊9秧1鸯1痒3蛘2漾4鞅9鞅6旸2飏2垟2",
"ben": "1:夯9本3坌4奔9奔6苯3贲6畚3笨4锛1犇1",
"tou": "1:头5头7投2透4偷1骰2",
"nu": "1:奴2努3呶8孥2弩3驽2怒4胬3",
"ning": "1:宁7宁9佞4咛2拧7拧9拧8泞4狞2柠2聍2甯2凝2",
"zhu": "2:主9主8宁9术7伫4朱1竹2住4助9苎4侏1拄3杼4注4竺2诛1贮4邾1驻4柚7柱9柱8洙1炷4祝9茱1株1烛2珠1疰4诸1逐2庶9渚3猪1舳5著4蛀4铢1属8煮3筑4蛛1铸4瘃2褚8槠1潴1箸4翥4嘱3橥1麈3瞩3躅7註4",
"gui": "2:宄3归6圭1轨3妫1庋3龟6刽4刿4匦3柜9炅9炔9规1诡3癸3皈1贵4闺1鬼3桂4桧9硅1晷3瑰1跪4鲑6簋3鳜9珪1",
"ga": "1:尕3轧7夹6旮1钆2伽6尬4呷6咖6尜2嘎8嘎6噶2",
"kao": "1:尻1考3拷3栲3烤3铐4犒4靠4",
"ni": "1:尼7尼8伲9伲8你3拟3呢7坭2妮1怩2泥7泥9昵4逆4倪2匿4铌2旎3猊2溺9睨4腻4霓2鲵2嶷9",
"zuo": "2:左3佐3作9作6坐4阼4怍4昨2祚4胙4唑4座4做4笮7琢7嘬6撮8",
"qiao": "2:巧3乔2壳9侨2俏4峤7荞2诮4峭4悄8悄6桥2窍4硗1雀8雀6愀3翘7翘9跷1劁7劁6敲1谯7谯9锹1憔2撬4蕉7鞒2樵2橇1缲1鞘9瞧2硚2",
"shuai": "3:帅4甩3衰1率9摔1蟀4",
"hong": "1:弘2讧4红7宏2闳2泓2轰1哄9哄8哄6洪2荭2虹2訇1烘1鸿2蕻7蕻9薨1黉2翃2竑2鋐2",
"di": "1:氐8氐6地9低1弟4狄2诋3邸3坻8底8抵3的7的9籴2迪2帝4柢3娣4敌2涤2砥3荻2递4笛2第4羝1谛4堤1提6棣4睇4缔4蒂4觌2嘀7嘀6嫡2滴1碲4翟7骶3镝7镝6頔2菂4啲1",
"de": "1:地5底5的5得7得5锝2德2徳2嘚6",
"min": "1:民2皿3闵3岷2抿3泯3玟2苠2黾8珉2闽3悯3敏3缗2愍3鳘3旻2慜3旼2",
"pie": "2:氕1苤3撇8撇6瞥1",
"yong": "1:永3用4佣9佣6甬3咏3拥1泳3俑3勇3涌8痈1邕1庸1恿3喁7蛹3雍1墉1慵1踊3壅1镛1臃1鳙1饔1埇3",
"han": "1:汉4邗2汗7汗9犴6含7含9旱4罕3邯2函2顸1悍4捍4晗2涵2焊4焓2菡4蚶1喊3寒2酣1韩2感9颔4撖4憨1憾4撼4翰4鼾1瀚4",
"xuan": "2:玄2县7轩1券9泫4宣1炫4绚4选3痃2眩9铉4悬2旋7旋9谖1喧1揎1渲4萱1暄1楦4煊1漩2碹4儇1璇2镟4癣3瑄1玹2禤1烜3",
"gua": "2:瓜1刮1卦4呱8呱6诖4剐3挂4胍1栝6鸹1褂4寡3",
"dian": "2:电4佃9甸4阽9典3坫4店4垫4点8点5玷4钿9惦4掂1淀4奠4殿4滇1碘3踮3靛4颠1癜4簟4巅1癫1槙1",
"bai": "1:白2百3伯8呗9佰3败4陌8拜4柏8捭3掰1摆3稗4栢3",
"xue": "2:穴2学2削6泶2谑4雪3靴1踅2噱7薛1鳕3",
"rang": "1:让4嚷8嚷6壤3攘3禳2瓤2穰7穰8",
"xun": "1:训4讯4寻2巡2旬2汛4迅4驯4询2郇7勋1峋2徇4恂2洵2荀2荤6荨7逊4埙1殉4浚9巽4循2熏9熏6窨6鲟2潭7蕈4獯1薰1曛1醺1浔2珣2",
"mang": "1:邙1忙2芒2氓7盲2茫2莽3硭2漭3蟒3",
"qiong": "2:邛2穷2穹2茕2筇2琼2蛩2跫2銎1",
"kuang": "2:邝4匡1圹4夼3纩4况4旷4狂2矿4诓1哐1诳2贶4框4眶4筐1",
"niao": "2:鸟8尿9茑3袅3脲4溺9嬲3",
"nong": "1:农2弄9侬2哝2浓2脓2",
"long": "1:龙2弄9陇3咙2垄3垅3拢3泷7茏2栊2珑2胧2砻2笼7笼8聋2隆2癃2窿2",
"cheng": "2:丞2成2呈2承2枨2诚2城2柽1乘7埕2秤9秤6称6称9逞3骋3盛7蛏1铖2铛6惩2程2裎7裎8塍2酲2噌6撑1樘6澄7橙2瞠1珵2澂2",
"deng": "1:邓4灯1登1等3戥3凳4噔1嶝4澄9瞪4磴4镫4簦1蹬9蹬6",
"diu": "2:丢1铥1",
"gen": "1:亘4艮9艮8哏7茛4根1跟1",
"chan": "2:产3忏4单7觇1谄3婵2掺6谗2铲3阐3孱7搀1禅7蒇3馋2缠2蝉2廛2潺2骣3澶2冁3蟾2颤9羼4躔2產3瀍2浐3",
"zhan": "2:蘸4占9占6斩3沾1战4栈4毡1展3旃1盏3站4崭3粘6绽4湛4搌3詹1辗8谵1瞻1颤9佔4霑1",
"ang": "0:仰7昂2肮6盎4",
"kuai": "2:会9块4快4侩4郐4哙4浍9狯4脍4筷4蒯3",
"chen": "2:伧5尘2臣2忱2沉2辰2陈2抻1衬4宸2称9郴1龀4晨2谌2琛1趁4嗔6榇4碜3谶4",
"chong": "2:充1冲9冲6虫7忡1宠3种7茺1重7涌6崇2舂1铳4憧1艟1翀1",
"guan": "2:关1观9观6串9纶6官1贯4冠9冠6矜6倌1莞8莞6惯4掼4涫4馆3棺1管3盥4鳏1灌4鹳4罐4",
"xing": "1:兴9兴6刑2行7邢2饧2形2杏4陉2姓4幸4性4型2星1省8荇4荥7悻4硎2惺1猩1腥1醒3擤3",
"hang": "1:夯6行7行9吭7沆4杭2炕6肮7巷9绗2桁7珩7航2颃2",
"jun": "1:军1君1均1龟6俊4郡4钧1峻4捃4浚9隽9骏4皲1菌9菌6竣4筠6麇6珺4埈4",
"dang": "1:凼4当6当9宕4砀4挡9挡8荡4党3档4菪4裆1铛6谠3氹4",
"lie": "2:列4劣4冽4咧5咧9洌4埒4烈4捩4猎4裂8裂9趔4躐4鬣4",
"chuang": "3:创9创6闯3床2怆4疮1窗1幢7",
"yan": "1:厌9延2闫2严2妍2芫7言2阽7兖3奄3岩2沿2炎2俨3咽9咽6埏2彦4恹1研7研9砚4衍3剡8唁4宴4晏4殷6烟1盐2胭1艳4铅7验4偃3厣3崦1掩3淹1焉1眼3谚4郾3阉1阎2阏6堰4湮1焰4焱4琰3筵2腌6蜒2雁4滟4罨3鄢1嫣1演3酽4谳4颜2餍4魇3燕9燕6赝4檐2鼹3龑3棪3",
"xu": "1:吁6圩6旭4许3序4盱1诩3叙4恤4洫4浒8砉6胥1须1徐2栩3畜9勖4绪4续4虚1酗4婿4溆4絮4煦4蓄4嘘6蓿0需1墟1糈3醑3顼1谞1",
"ming": "1:名2命4明2鸣2茗2冥2铭2溟2酩3暝2瞑2螟2洺2",
"hou": "1:后4吼3侯7侯9厚4後4逅4候4喉2堠4猴2鲎4瘊2篌2糇2骺2垕4",
"lü": "1:吕3驴2侣3律4闾2捋8旅3虑4偻8率9稆3绿9铝3屡3氯4缕3榈2滤4膂3褛3履3",
"nan": "1:囝6囡1男2南7难7难9赧3喃2楠2腩3蝻3",
"tuan": "2:团2抟2彖4湍1疃3",
"zhen": "2:圳4贞1阵4诊3针1侦1枕3帧1浈1珍1胗8胗6轸3鸩4振9振9朕4桢1畛3疹3真1砧1祯1赈4斟1椹6溱6甄1缜3蓁1榛1稹3箴1镇4震4臻1",
"zhuang": "3:壮4妆1庄1状4奘8桩1装1僮9幢9撞4戆9",
"su": "1:夙4苏1诉4肃4俗2涑4素4速4宿9粟4谡4酥1嗉4塑4愫4溯4稣1僳4缩9蔌4觫4簌4窣1甦1",
"xiu": "2:休1朽3秀4岫4修1咻1庥1绣4羞1臭9袖4宿9宿8鸺1锈4嗅4溴4貅1馐1髹1琇4脩1",
"kua": "2:夸1侉3垮3挎4胯4跨4",
"sun": "1:孙1狲1荪1损3笋3隼3飧1榫3",
"zhai": "2:宅2侧6择7责9债4斋1柴9窄3砦4祭9寨4摘1翟7瘵4",
"sui": "2:岁4尿6虽1祟4绥2荽0谇4眭1隋7隋6随2遂7遂9睢6碎4粹9隧4濉1燧4穗4邃4髓3",
"zhou": "2:州1纣4舟1肘3诌1周1咒4妯2宙4帚3绉4昼4洲1祝9胄4荮4轴7轴9皱4调6酎4啁6舳9粥6碡0繇9骤4籀4",
"qing": "1:庆4苘3青1顷3亲9氢1轻1倩9倾1卿1请3圊1情2清1晴2氰2箐4綮9蜻1擎2檠2磬4鲭6罄4謦3黥2",
"quxu": "3:戌1",
"kuo": "2:扩4括4栝9蛞4阔4廓4",
"sao": "1:扫9扫8埽4嫂3搔1骚1瘙4缫1燥9臊4鳋1",
"zao": "1:早3灶4皂4枣3蚤3唣4造4凿2遭1噪4澡3燥9糟1藻3躁4",
"la": "1:旯2垃1拉7拉8拉6剌7剌9砬2啦6喇7喇8喇6腊9落9瘌4蜡9辣4癞9邋1啦5",
"piao": "2:朴7莩8殍3票9票6剽1嘌9嘌6嫖2漂9漂8漂6缥8缥6骠9飘1瓢2瞟3螵1",
"sha": "2:杀1杉6沙9沙6纱1刹6砂1莎6唼4啥2奢7挲6铩1厦9痧1傻3嗄9歃4煞9煞6裟1噎6鲨1霎4",
"cuan": "2:汆1窜4撺1篡4镩9镩6攒7蹿1爨4",
"tang": "1:汤9汤6帑3倘8唐2烫4堂2惝8淌3铴9铴6傥3棠2塘2搪2溏2瑭2耥3樘7羰1膛2趟9趟6躺3糖2螗2镗7镗6螳2醣2蹚1",
"pin": "1:牝4拚6贫2品3姘1拼1娉9嫔2榀3聘4频2颦2",
"mou": "1:牟7侔2哞1某3眸2谋2蛑2缪7鍪2",
"mi": "1:米3糸4汨4芈3宓4弥2泌9觅4咪8咪6弭3祢2迷2敉3秘9脒3密4猕2眯7眯8眯6谜7幂4谧4嘧4蜜4醚2糜7縻2麋2靡7靡8蘼2沕4",
"fou": "1:缶3否8",
"lao": "1:老3劳2牢2佬3姥8络9唠7唠9崂2捞1栳3涝7涝9烙9铑3痨2落9铹2耢4酪4潦7潦9潦8獠8醪2",
"lei": "1:耒3肋9泪4诔3垒3类4勒5勒6累7累9累8雷7雷9嘞5嫘2漯8缧2酹4磊3擂7擂9蕾3儡7儡8檑4镭2羸2罍2",
"rou": "1:肉4柔2揉2糅2蹂2鞣2",
"sai": "1:思6塞9塞6腮1赛4噻1鳃1",
"se": "1:色9涩4啬4铯4塞9瑟4穑4",
"shai": "2:色8晒4筛1酾6",
"que": "2:芍9却4炔6缺1悫4雀9确4阕4阙9阙6鹊4榷4瘸2",
"du": "1:芏4妒4杜4肚9肚8度9毒2独2笃3读7都6堵3渎7椟2渡4牍2犊2赌3嘟1督1睹3镀4黩2髑2蠹4",
"duo": "2:多1夺2朵3驮8剁3咄1沲3哆1哚3垛8垛8度7铎2堕8缍3舵3惰4裰1跺3躲3踱2掇1",
"heng": "1:行7亨1恒2哼1桁7珩7横7横9衡2蘅2姮2恆2",
"ne": "1:讷4那9呐9呢5哪7",
"song": "1:讼4宋4忪6怂3松1诵4送4凇1悚3耸3颂4崧1淞1菘1竦3嵩1",
"guo": "2:过9过6呙1国2果3埚1涡6郭1崞1帼2掴2猓1椁3聒1锅1蜾3蝈1裹3虢2馘2粿3馃3囯2",
"nuo": "2:那7娜7挪2诺4喏9傩2搦4锘4懦4糯4",
"bang": "1:邦1帮1绑3旁9梆1浜1蚌9傍4棒4谤4蒡4榜9榜8膀9膀8磅9镑4",
"ruan": "2:阮3朊3软3",
"liang": "2:两3良2亮4俩8凉7凉9莨7谅4梁2辆4晾4椋2量7量9靓9粮2粱2墚2踉7踉9魉3樑2",
"luan": "2:乱4卵3娈2孪2峦2挛2栾2鸾2脔2滦2銮2",
"ti": "1:体8体6屉4剃4荑7倜4剔1悌4涕4绨7绨9逖4惕4梯1啼2提7替4缇2锑1鹈2裼9踢1题2蹄2醍7醍8嚏4俶9",
"fo": "1:佛7",
"mian": "2:免8沔3勉3眄3面4娩3眠2冕3渑8绵2棉2湎3缅3腼3",
"leng": "1:冷3塄2愣4棱6楞7楞9",
"bie": "2:别7别9憋1瘪8瘪6蹩2鳖1",
"lin": "1:吝4邻2拎1林2临7临9赁4啉7啉9淋7淋9琳2粼2蔺4凛3嶙2遴2廪3懔3膦4辚2霖2檩3瞵2磷2鳞2躏4麟2璘2",
"qin": "1:吣4沁4芩2芹2亲6侵1矜7钦1秦2衾1揿4琴2禽2覃7锓3勤2嗪2寝3溱7廑7噙2擒2檎2螓2琹2",
"dun": "1:吨1囤9沌9炖4盹3盾4砘4钝4趸3顿4敦6遁4墩1礅1镦6蹲6惇1",
"keng": "1:吭6坑1铿1",
"shun": "2:吮3顺4舜4瞬4",
"chao": "2:吵8吵6抄1怊1炒3钞1晁2耖4巢2绰6朝7焯6超1剿6嘲7潮2",
"zhao": "2:爪8召4兆4找3诏4钊1招1沼3昭1赵4笊4啁6着7着6朝6棹4照4罩4肇4嘲6曌4炤4",
"chui": "3:吹1垂2炊1陲2捶2棰2椎7槌2锤2",
"gao": "1:告4杲3诰4郜4皋6羔1高1锆4搞3缟3槁3槔1睾1膏9膏6稿3镐8篙1糕1藁3",
"qiang": "2:呛9呛6抢8抢6羌1戕1戗9戗6枪1炝4将6羟3跄9跄6强7强8腔1蜣1锖1墙2嫱2蔷2锵1樯2襁3镪8镪6",
"jiang": "2:匠4江1讲3降9奖3姜1将9将6洚4绛4茳1桨3浆1豇1强9蒋3酱4僵1犟4缰1耩3礓1糨4疆1",
"kun": "1:困4坤1昆1悃3捆3阃3琨1锟1髡1醌1鲲1堃1崑1焜1",
"huai": "2:坏4怀2徊2淮2槐2踝2",
"zhui": "3:坠4隹1追1缀4骓1惴4椎6缒4锥1赘4",
"lian": "2:奁2连2帘2怜2练4炼4恋4涟2莲2敛3殓4琏3脸3联2裢2裣3链4廉2楝4潋4蔹3鲢2濂2臁2镰2蠊2",
"miao": "2:妙4庙4杪3苗2眇3秒3喵1描2淼3渺3缈3瞄2鹋2缪9藐3邈3",
"ceng": "1:层2曾7噌6蹭4",
"cen": "1:岑2参6涔2",
"ku": "1:库4刳1苦8枯1绔4哭1堀1喾4裤4窟1酷4骷1",
"ying": "1:应9应6迎2英1茔2映4盈2荥7荧2郢3莹2莺1婴1萤2营2萦2瑛1硬4颍3媵4楹2滢2蓥2颖2嘤1撄1潆2缨1罂1蝇2影3樱1璎1嬴2瘿3鹦1膺1赢2鹰1瀛2",
"te": "1:忑4忒9特4铽4慝4",
"tui": "2:忒6退4推1煺4腿3蜕4颓2褪9",
"wo": "1:我3沃4肟4卧4挝6倭1涡6莴1喔1幄4握4渥4硪4窝1蜗1斡4龌4",
"rao": "1:扰3娆7娆8绕4荛7饶2桡2",
"geng": "1:更9更6庚1哽3埂3绠8耕1耿3梗3颈3赓1鲠3羹1",
"biao": "2:杓6表3彪1标1飑1髟1婊3裱3骠6膘1瘭1镖1飙1飚1鳔4镳1",
"tiao": "2:条2佻1苕7迢2挑8挑6祧1调7眺4窕3笤2粜4跳4龆2蜩2髫2鲦2",
"lai": "1:来7来6崃1徕7徕6涞1莱1赉2睐2铼1赖2濑2癞7籁2",
"pei": "1:沛4佩4呸1帔4胚1旆4配4陪2培2赔2辔4锫2裴2醅1霈4珮4",
"zhuo": "3:灼2卓2拙1茁2斫2浊2倬1捉1桌1浞2诼2酌2啄2涿1着7焯6琢7禚2缴7擢3濯2镯2躅7叕2",
"chun": "2:纯2春1唇2莼2淳2椿1鹑2蝽1醇2蠢3",
"zong": "1:纵4宗1枞6总3偬3综6棕1腙1粽4踪1鬃1",
"huang": "2:肓1恍3皇2荒1晃9晃8凰2谎3隍2黄2徨2惶2慌8慌6湟2遑2幌3煌2潢2璜2篁2蝗2癀2磺2簧2蟥2鳇2",
"rui": "2:芮4枘4蚋4锐4瑞4睿4蕊3蕤2叡4",
"zu": "1:诅3足2阻3卒7组3苴6俎3祖3租1族2菹1镞2",
"zou": "1:走3邹1驺1奏4诹1陬1揍4鄹1鲰1",
"zhei": "2:这9",
"run": "1:闰4润4",
"sang": "1:丧9丧6桑1嗓3搡3磉3颡3",
"guai": "2:乖1怪4拐3",
"chai": "2:侪2拆6钗1差9差6虿4柴7豺2瘥9",
"shua": "3:刷9刷6耍3唰1",
"cu": "1:卒9徂2促4殂2猝4粗1酢4蔟4趣9醋4簇4蹙4蹴9",
"ha": "1:呵6哈9哈8哈6虾7铪1蛤7",
"nao": "1:呶7闹4垴3恼3挠2孬1脑3淖4硇2铙2猱2蛲2瑙3",
"zui": "2:咀6最4罪4觜8蕞4醉4嘴3",
"meng": "1:孟4氓7黾8虻2勐3梦4猛3萌2盟2蒙7蒙8蒙6锰3甍2艋3蜢3瞢2朦2檬2懵3礞2艨2蠓3濛2獴3",
"tie": "2:帖9帖8帖6贴1铁3萜1餮4",
"peng": "1:怦1抨1朋2砰1堋2捧3烹1彭2棚2硼2碰4蓬2鹏2嘭1澎2篷2膨2蟛2芃2椪4",
"suo": "2:所3唆1唢3娑1索3莎6挲6桫1梭1琐3睃1锁3嗍1嗦0羧1蓑1缩6",
"ca": "1:拆6嚓6擦1礤3",
"pai": "1:拍1迫8哌4派9俳2徘2排7排8湃4牌2蒎4",
"hun": "1:昏1诨3浑7浑8荤6珲7婚1混7混8阍1馄2溷3魂2",
"luo": "2:泺4罗2咯9洛4络9荦4骆4倮3捋6烙9珞4猡2硌9脶2萝2逻2椤2落9落6跞9裸3锣2摞4漯9箩2雒4骡2瘰3镙2螺2蠃3蠡7啰5啰7啰6",
"bin": "1:玢6宾1彬1傧1斌1摈4滨1缤1槟6殡4膑4镔1濒1豳1髌4鬓4",
"weng": "1:瓮4翁1嗡1蓊3蕹4",
"ken": "1:肯3垦3恳3啃3裉4",
"yo": "1:育6哟5哟6唷1",
"re": "1:若8热4喏8惹3",
"ruo": "2:若9偌4弱4箬4叒4",
"zhuai": "3:转7拽9拽6",
"die": "2:迭2垤2爹1瓞2谍2喋7堞2揲7耋2跌1叠2牒2碟2蝶2蹀2鲽2昳7",
"lang": "1:郎2朗3浪4狼2莨7莨9阆4啷1廊2琅2榔2稂2锒2蒗4螂2崀4塱3蓢3",
"lou": "1:陋4娄2偻7喽5喽7嵝3搂8搂6蒌2楼2漏4瘘4镂4篓3耧2蝼2髅2露9",
"zang": "1:驵3奘9脏9脏6赃1葬4臧6藏9",
"lia": "2:俩8",
"lo": "1:咯5",
"zan": "1:咱2拶8昝3暂4糌1赞4錾4簪1攒8瓒4趱3",
"hen": "1:哏8很3恨4狠3痕2",
"zen": "1:怎3谮4",
"duan": "2:段4断4短3缎4椴4煅4端1锻4簖4",
"beng": "1:泵4甭2迸4蚌9崩1绷9绷8绷6嘣1甏4蹦4",
"pen": "1:盆2喷9喷6湓2",
"cao": "1:草3曹2嘈2漕2槽2操1糙1艚2螬2",
"pou": "1:剖1掊7掊8裒2",
"cuo": "2:厝4挫4措4脞3嵯2搓1痤2矬2锉4错4瘥7磋1撮6蹉1鹾2",
"sou": "1:叟8叟6嗖1搜1溲1馊1飕1嗽4嗾3瞍3锼1艘1螋1擞9擞8薮3",
"o": "0:哦7噢1",
"man": "1:埋7曼4蛮2满3谩7谩9墁4幔4慢4漫4缦4蔓7蔓9馒2熳4瞒2螨3镘4鞔2颟1鳗2嫚9嫚6",
"kuan": "2:宽1款3髋1",
"nen": "1:恁4嫩4",
"en": "0:恩1摁4蒽1",
"suan": "2:狻1蒜4算4酸1",
"teng": "1:疼2腾2誊2滕2藤2",
"neng": "1:能2",
"cui": "2:脆4啐9崔1悴4淬4萃4毳4催1瘁4摧1榱1粹9翠4璀3",
"gun": "1:衮3绲3棍9棍8辊3滚3磙3鲧3",
"shei": "2:谁7",
"zei": "1:贼2",
"qun": "1:逡1裙2群2麇7",
"zuan": "2:钻9钻6赚9缵3纂3攥4躜1",
"cou": "1:凑4楱4腠4辏4",
"chuai": "3:啜9揣9揣8揣6搋1嘬9膪4踹4",
"chuo": "3:啜9辍4踔1龊4戳1绰9绰5",
"dei": "1:得8嘚6",
"nin": "1:您2",
"lüe": "2:掠4略4锊4",
"zeng": "1:综9曾6锃4增1憎1缯9缯6甑4赠4罾1",
"zun": "1:尊1撙3遵1樽1鳟1",
"sen": "1:森1",
"hei": "1:黑1嗨6嘿6",
"ng": "0:嗯9嗯7嗯8",
"n": "0:嗯7嗯8嗯9",
"dia": "2:嗲3",
"nuan": "2:暖3",
"miu": "2:谬4缪9",
"seng": "1:僧1",
"niang": "2:酿4孃2嬢2",
"nou": "1:耨4",
"nang": "1:曩3囊7囊6馕7馕8囔1攮3齉4"
}

View File

@ -1,130 +0,0 @@
"use strict";
var dict = require('./spell-dict-jian.json');
var initialDict = require('./info-dict.json').initial;
var arg = {
simple: 'simple',
trad: 'trad',
poly: 'poly',
alltone: 'alltone',
array: 'array'
};
var _ = {}; // 工具方法
function initSpellToWord(cnchar) {
_ = cnchar._;
cnchar.spellToWord = spellToWord;
spellInfo.tones = _.tones.split('');
spellInfo.initials = initialDict;
cnchar.spellInfo = spellInfo;
cnchar.type.spellToWord = arg;
} // 获取拼音信息 spell,tone,index,initial,final
function spellInfo(spell) {
spell = spell.toLowerCase();
var info = _.removeTone(spell, false);
if (info.index === -1) {
if (!dict[info.spell]) {
throw new Error('【spellInfo】错误的拼音: ' + spell);
}
info.index = parseInt(dict[info.spell][0]) + 1;
}
var initial = '';
var _final = info.spell;
for (var i = 0; i < initialDict.length; i++) {
if (info.spell.indexOf(initialDict[i]) === 0) {
initial = initialDict[i];
_final = info.spell.substr(initial.length);
break;
}
}
info.initial = initial;
info["final"] = _final;
return info;
}
function spellToWord() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var spell = args[0].toLowerCase();
if (typeof spell !== 'string') {
throw new Error('spellToWord: 输入必须是字符串');
}
var info = _.transformTone(spell, false);
args = args.splice(1);
_.checkArgs('spellToWord', args);
var argRes = {
simple: _.has(args, arg.simple),
trad: _.has(args, arg.trad),
poly: _.has(args, arg.poly),
alltone: _.has(args, arg.alltone)
};
if (!argRes.simple && !argRes.trad) {
argRes.simple = argRes.trad = true;
}
var res = '';
var str = dict[info.spell].substr(2);
for (var i = 0; i < str.length; i += 2) {
var word = str[i];
var tone = parseInt(str[i + 1]);
var isPoly = tone > 4;
if (isPoly) {
tone = tone - 5;
}
if (res.indexOf(word) === -1 && (argRes.alltone || tone === info.tone)) {
if (!argRes.poly || isPoly) {
res += word;
}
}
}
if (argRes.trad && _.convert) {
var tradRes = '';
for (var _i = 0; _i < res.length; _i++) {
var trad = _.convert.simpleToTrad(res[_i]);
if (trad !== res[_i]) {
tradRes += trad;
}
}
if (!argRes.simple) {
res = tradRes;
} else {
res += tradRes;
}
}
if (_.has(args, arg.array)) {
return res.split('');
}
return res;
}
module.exports = {
initSpellToWord: initSpellToWord,
spellInfo: spellInfo
};

View File

@ -1,39 +0,0 @@
{
"0": "",
"1": "一乙",
"2": "丁七乃乜九了二人亻儿入八冂几凵刀刁力勹匕十厂厶又卜乂",
"3": "万丈三上下丌个丫丸久乇么义乞也习乡亍于亏亡亿兀凡刃勺千卫叉口囗土士夕大女子孑孓寸小尢尸山巛川工己已巳巾干幺广廾弋弓才门飞马与之及",
"4": "不丐丑专中丰丹为乌书予云互亓五井亢什仁仂仃仄仅仆仇仉今介仍从仑仓允元公六兮内冈冗凤凶分切刈劝办勾勿匀化匹区卅升午卞厄厅历友双反壬天太夫夭孔少尤尹尺屯巴币幻廿开引心忆戈户手扎支攴攵文斗斤方无日曰月木欠止歹殳毋比毛氏气水火爪父爻爿片牙牛犬王瓦肀艺见计订讣认讥贝车邓长闩队韦风乏以巨巿冇",
"5": "讬且丕世丘丙业丛东丝主乍乎乐仔仕他仗付仙仝仞仟仡代令仨仪仫们兄兰冉册写冬冯凸凹出击刊刍功加务劢包匆北匝卉半卟占卡卢卮卯厉去发古句另叨叩只叫召叭叮可台叱史右叵叶号司叹叻叼叽囚四圣处外央夯失头奴奶孕宁它宄对尔尕尻尼左巧市布帅平幼庀弁弗弘归必忉戊戋扑扒打扔斥旦旧未末本札术正母氐民氕永汀汁汇汉灭犯犰玄玉瓜甘生用甩田由甲申电疋白皮皿目矛矢石示礼禾穴立纠艽艾艿节讦讧讨让讪讫训议讯记轧边辽邗邙邛邝钅闪阡阢饥驭鸟龙印戉氹奵",
"6": "丞丢乒乓乔乩买争亘亚交亥亦产仰仲仳仵件价任份仿企伉伊伍伎伏伐休众优伙会伛伞伟传伢伤伥伦伧伪伫佤充兆先光全共关兴再军农冰冱冲决凫凼刎刑划刖列刘则刚创劣动匈匠匡华协危压厌厍吁吃各吆合吉吊同名后吏吐向吒吓吕吖吗囝回囟因囡团在圩圪圬圭圮圯地圳圹场圾壮夙多夷夸夹夺夼奸她好妁如妃妄妆妇妈字存孙宅宇守安寺寻导尖尘尥尧尽屹屺屿岁岂岌州巡巩帆师年并庄庆延廷异式弛当忏忖忙戌戍戎戏成托扛扣扦执扩扪扫扬收旨早旬旭旮旯曲曳有朱朴朵机朽杀杂权次欢此死毕氖氘氽汆汊汐汔汕汗汛汜汝江池污汤汲灯灰爷牝牟犴犷犸玎玑百祁竹米糸纡红纣纤纥约级纨纩纪纫缶网羊羽老考而耒耳聿肉肋肌臣自至臼舌舛舟艮色芄芊芋芍芎芏芑芒芗芝芨虍虫血行衣西观讲讳讴讵讶讷许讹论讼讽设访诀贞负轨达迁迂迄迅过迈邡邢那邦邪邬钆钇闫闭问闯阪阮阱防阳阴阵阶页饧驮驯驰齐似吸芃邨吋贠孖屾叒玏岀甪",
"7": "两严串丽乱亨亩伯估伲伴伶伸伺伽佃但位低住佐佑体何佗佘余佚佛作佝佞佟你佣佥佧克免兑兕兵况冶冷冻初删判刨利别刭助努劫劬劭励劲劳匣医卣卤即却卵县君吝吞吟吠吡吣否吧吨吩含听吭吮启吱吲吴吵吹吻吼吾呀呃呆呈告呋呐呒呓呔呕呖呗员呙呛呜囤囫园困囱围囵圻址坂均坊坌坍坎坏坐坑块坚坛坜坝坞坟坠声壳奁奂妊妍妒妓妖妗妙妞妣妤妥妨妩妪妫姊姒孚孛孜孝宋完宏寿尬尾尿局屁层岈岍岐岑岔岖岗岘岙岚岛岜希帏帐庇床庋序庐庑库应弃弄弟张形彤彷役彻忌忍忐忑忒志忘忡忤忧忪快忭忮忱忸忻忾怀怃怄怅怆我戒扭扮扯扰扳扶批扼找技抄抉把抑抒抓投抖抗折抚抛抟抠抡抢护报拒拟攸改攻旰旱时旷更杆杈杉杌李杏材村杓杖杜杞束杠条来杨杩极欤步歼每氙氚求汞汨汩汪汰汴汶汹汽汾沁沂沃沅沆沈沉沌沏沐沔沙沛沟没沣沤沥沦沧沩沪泐泛灵灶灸灼灾灿炀牡牢状犹狁狂狃狄狈玖玛甫甬男甸町疔疖疗皂盯矣矶社祀秀私秃究穷系纬纭纯纰纱纲纳纵纶纷纸纹纺纽纾罕羌肓肖肘肚肛肜肝肟肠良芈芘芙芜芟芡芤芥芦芩芪芫芬芭芮芯芰花芳芴芷芸芹芽芾苁苄苇苈苊苋苌苍苎苏苡苣虬补角言证诂诃评诅识诈诉诊诋诌词诎诏译诒谷豆豕豸贡财赤走足身轩轫辛辰迎运近迓返迕还这进远违连迟邑邮邯邰邱邳邴邵邶邸邹邺邻酉里针钉钊钋钌闰闱闲闳间闵闶闷阻阼阽阿陀陂附际陆陇陈陉韧饨饩饪饫饬饭饮驱驳驴鸠鸡麦龟巫囧旸佔飏呎釆佈玙囯沕",
"8": "丧乖乳事些亟享京佩佬佯佰佳佴佶佻佼佾使侃侄侈侉例侍侏侑侔侗供依侠侣侥侦侧侨侩侪侬兔兖其具典冼冽净凭凯函刮到刳制刷券刹刺刻刽刿剀剁剂劾势匦卑卒卓单卖卦卧卷卺厕叁参叔取呢呤呦周呱味呵呶呷呸呻呼命咀咂咄咆咋和咎咏咐咒咔咕咖咙咚咛咝哎囹固国图坡坤坦坨坩坪坫坭坯坳坶坷坻坼垂垃垄垅垆备夜奄奇奈奉奋奔妮妯妲妹妻妾姆始姐姑姓委姗孟孢季孤孥学宓宕宗官宙定宛宜宝实宠审尚居屈屉届岢岣岩岫岬岭岱岳岵岷岸岽岿峁峄帑帔帕帖帘帙帚帛帜幸底庖店庙庚府庞废建弥弦弧弩弪录彼往征徂径忝忠念忽忿态怂怊怍怏怔怕怖怙怛怜怡怦性怩怪怫怯怵怿戕或戗戽戾房所承抨披抬抱抵抹抻押抽抿拂拄担拆拇拈拉拊拌拍拎拐拓拔拖拗拘拙拚招拢拣拥拦拧拨择放斧斩於旺昀昂昃昆昊昌明昏易昔昕昙朊朋服杪杭杯杰杲杳杵杷杼松板构枇枉枋析枕林枘枚果枝枞枢枣枥枧枨枪枫枭柜欣欧武歧殁殴氓氛沓沫沭沮沱沲河沸油治沼沽沾沿泄泅泊泌泓泔法泖泗泞泠泡波泣泥注泪泫泮泯泱泳泷泸泺泻泼泽泾浅炅炉炊炎炒炔炕炖炙炜炝炬爬爸版牦牧物狍狎狐狒狗狙狞玟玢玩玫玮环现瓮瓯甙画甾畀畅疙疚疝疟疠疡的盂盱盲直知矸矽矾矿砀码祆祈祉秆秉穸穹空竺籴线绀绁绂练组绅细织终绉绊绋绌绍绎经绐罔罗者耵耶肃股肢肤肥肩肪肫肭肮肯肱育肴肷肺肼肽肾肿胀胁臾舍艰苑苒苓苔苕苗苘苛苜苞苟苠苤若苦苫苯英苴苷苹苻茁茂范茄茅茆茇茉茌茎茏茑茔茕茚虎虏虮虱表衩衫衬规觅视诓诔试诖诗诘诙诚诛诜话诞诟诠诡询诣诤该详诧诨诩责贤败账货质贩贪贫贬购贮贯转轭轮软轰迢迤迥迦迨迩迪迫迭迮述迳邾郁郄郅郇郊郎郏郐郑郓采金钍钎钏钐钒钓钔钕钗闸闹阜陋陌降限陔陕隶隹雨青非顶顷饯饰饱饲饴驵驶驷驸驹驺驻驼驽驾驿骀鱼鸢鸣黾齿受变弢祎玥旻昇劼昉咘旼劵毑祇叕炘泃佺",
"9": "临举亭亮亲侮侯侵便促俄俅俊俎俏俐俑俗俘俚俜保俞俟信俣俦俨俩俪俭修兹养冒冠剃削剌前剐剑勃勇勉勋匍南卸厘厚叙叛呲咣咤咦咧咨咩咪咫咬咭咯咱咳咴咸咻咽咿哀品哂哄哆哇哈哉哌响哏哐哑哒哓哔哕哗哙哚哜哝哞哟哪囿型垌垒垓垛垠垡垢垣垤垦垧垩垫垭垮垲垴城埏复奎奏契奕奖姘姚姜姝姣姥姨姹姻姿威娃娄娅娆娇娈娜孩孪客宣室宥宦宪宫封将尜尝屋屎屏峋峒峙峡峤峥峦差巷帝带帧帮幽庠庥度庭弈弭弯彖彦待徇很徉徊律後怎怒思怠急怨总怼恂恃恍恒恢恤恨恪恫恬恸恹恺恻恼恽战扁扃拜括拭拮拯拱拴拶拷拼拽拾持挂指按挎挑挖挝挞挟挠挡挢挣挤挥挪挺政故斫施既昝星映春昧昨昭是昱昴昵昶昼显曷朐枯枰枳枵架枷枸柁柃柄柏某柑柒染柔柘柙柚柝柞柠柢查柩柬柯柰柱柳柽柿栀栅标栈栉栊栋栌栎栏树歪殂殃殄殆殇残段毒毖毗毡氟氡氢泉泵泶洁洄洇洋洌洎洒洗洙洚洛洞津洧洪洫洮洱洲洳洵洹活洼洽派浃浇浈浊测浍济浏浑浒浓浔涎炫炭炮炯炱炳炷炸点炻炼炽烀烁烂烃爰牮牯牲牵狠狡狨狩独狭狮狯狰狱狲玲玳玷玻珀珂珈珉珊珍珏珐珑瓴甚甭畈畋界畎畏疣疤疥疫疬疮疯癸皆皇皈盅盆盈相盹盼盾省眄眇眈眉看眍眨矜矧矩砂砉砌砍砑砒研砖砗砘砚砜砭祓祖祗祚祛祜祝神祠祢禹禺秋种科秒秕秭穿窀突窃窆竖竽竿笃笈类籼籽绑绒结绔绕绗绘给绚绛络绝绞统缸罘罚美羿耍耐耔耷胂胃胄胆背胍胎胖胗胙胚胛胜胝胞胡胤胥胧胨胩胪胫脉舁舡舢舣茈茗茛茜茧茨茫茬茭茯茱茳茴茵茶茸茹茺茼荀荃荆荇草荏荐荑荒荔荚荛荜荞荟荠荡荣荤荥荦荧荨荩荪荫荬荭荮药莒莛虐虹虺虻虼虽虾虿蚀蚁蚂蚤衍衲衽衿袂袄要觇览觉訇诫诬语诮误诰诱诲诳说诵诶贰贱贲贳贴贵贶贷贸费贺贻赳赴赵趴轱轲轳轴轵轶轷轸轹轺轻迷迸迹追退送适逃逄逅逆选逊郗郛郜郝郡郢郦郧酊酋重钙钚钛钜钝钞钟钠钡钢钣钤钥钦钧钨钩钪钫钬钭钮钯闺闻闼闽闾阀阁阂陛陟陡院除陧陨险面革韭音顸项顺须飑飒食饵饶饷饺饼首香骁骂骄骅骆骇骈骨鬼鸥鸦鸨鸩叟恰祐昺垚珅玹洸屌浕浐畑闿咲怹昳陞査洺栃垵炤姮垟恆饹竑剎饸垕",
"10": "袅乘亳俯俱俳俸俺俾倌倍倏倒倔倘候倚倜借倡倥倦倨倩倪倬倭倮债值倾偌健党兼冢冤冥凄准凇凉凋凌剔剖剜剞剡剥剧勐匪匿卿厝原哥哦哧哨哩哭哮哲哳哺哼哽哿唁唆唇唉唏唐唑唔唛唠唢唣唤唧啊圃圄圆垸埂埃埋埒埔埕埘埙埚壶夏套奘奚姬娉娌娑娓娘娟娠娣娥娩娱娲娴婀孬宰害宴宵家宸容宽宾射屐屑展屙峨峪峭峰峻崂崃席帱座弱徐徒徕恁恋恐恕恙恚恝恣恧恩恭息恳恶悃悄悌悍悒悔悖悚悛悝悟悦悭悯扇拳拿挈挚挛挨挫振挹挽捂捃捅捆捉捋捌捍捎捏捐捕捞损捡换捣效敉敌敖斋料旁旃旄旅旆晁晃晋晌晏晒晓晔晕晖晟朔朕朗柴栓栖栗栝校栩株栲栳样核根格栽栾桀桁桂桃桄桅框案桉桊桌桎桐桑桓桔桕桠桡桢档桤桥桦桧桨桩梃梆殉殊殷毙毪氤氦氧氨氩泰流浆浙浚浜浞浠浣浦浩浪浮浯浴海浸浼涂涅消涉涌涑涓涔涕涛涝涞涟涠涡涣涤润涧涨涩烈烊烘烙烛烟烤烦烧烨烩烫烬热爱爹特牺狳狴狷狸狺狻狼猁猃玺珙珞珠珥珧珩班珲琊瓞瓶瓷畔留畚畛畜疰疱疲疳疴疸疹疼疽疾痂痃痄病症痈痉皋皱益盍盎盏盐监眙眚真眠眢眩砝砟砣砥砧砩砬砰破砷砸砹砺砻砼砾础祟祥祧祯离秘租秣秤秦秧秩秫积称窄窈窍站竞笄笆笊笋笏笑笔笕笫粉粑紊素索紧绠绡绢绣绥绦继绨缺罟罡罢羔羞翁翅耄耆耕耖耗耘耙耸耻耽耿聂胭胯胰胱胲胳胴胶胸胺胼能脂脆脊脍脎脏脐脑脒脓臬臭致舀舐舨航舫般舭舯舰舱艳荷荸荻荼荽莅莆莉莎莓莘莜莞莠莨莩莪莫莰莱莲莳莴莶获莸莹莺莼莽虑虔蚊蚋蚌蚍蚓蚕蚜蚝蚣蚧蚨蚩蚪蚬衄衮衰衷衾袁袍袒袖袜袢被觊请诸诹诺读诼诽课诿谀谁谂调谄谅谆谇谈谊豇豹豺贼贽贾贿赀赁赂赃资赅赆赶起趵趸趿躬軎轼载轾轿辁辂较辱逋逍透逐逑递途逖逗通逛逝逞速造逡逢逦邕部郫郭郯郴郸都酌配酎酏酐酒釜钰钱钲钳钴钵钶钷钸钹钺钻钼钽钾钿铀铁铂铃铄铅铆铈铉铊铋铌铍铎阃阄阅阆陪陬陲陴陵陶陷隼隽难顼顽顾顿颀颁颂颃预饽饿馀馁骊骋验骏高髟鬯鬲鸪鸫鸬鸭鸯鸱鸲鸳鸵鸶龀彧翀珮埇崀俶疍翃珣峯埗埈倓珪娭鸮栢烜託珽脩",
"11": "彪晚梢梧梨龛乾偃假偈偎偏偕做停偬偶偷偻偾偿傀兜兽冕减凑凰剪副勒勖勘匏匐匙匮匾厢厣厩唪唬售唯唰唱唳唷唼唾唿啁啃啄商啉啐啕啖啜啡啤啥啦啧啪啬啭啮啵啶啷啸喏喵圈圉圊埝域埠埤埭埯埴埸培基埽堀堂堆堇堋堍堑堕堵够奢娶娼婆婉婊婕婚婢婧婪婴婵婶孰宿寂寄寅密寇尉屠崆崇崎崔崖崛崞崤崦崧崩崭崮巢帷常帻帼庳庵庶康庸庹庾廊弹彗彩彬得徘徙徜恿悉悠患您悫悬悱悴悸悻悼情惆惊惋惕惘惚惜惝惟惦惧惨惬惭惮惯戚戛扈挲捧捩捭据捱捶捷捺捻掀掂掇授掉掊掎掏掐排掖掘掠探接控推掩措掬掭掮掳掴掷掸掺掼揶敏救敕教敛敝敢斛斜断旋旌旎族晗晡晤晦晨曹曼望桫桴桶桷梁梅梏梓梗梦梭梯械梳梵检棂欲欷殍殒殓毫氪涪涫涮涯液涵涸涿淀淄淅淆淇淋淌淑淖淘淙淝淞淠淡淤淦淫淬淮深淳混淹添清渊渌渍渎渐渑渔渖渗渚渠烯烷烹烽焉焊焐焓焕焖焘爽牾牿犁猊猎猓猕猖猗猛猜猝猞猡猪猫率球琅理琉琏琐瓠甜略畦疵痊痍痒痔痕痖皎皑皲盒盔盖盗盘盛眦眭眯眵眶眷眸眺眼着睁矫砦硅硇硌硎硐硒硕硖硗硭票祭祷祸秸移秽稆窑窒窕竟章笙笛笞笠笤笥符笨笪第笮笱笳笸笺笼笾筇粒粕粗粘粜粝累绩绪绫续绮绯绰绱绲绳维绵绶绷绸绺绻综绽绾绿缀缁缍羚羝羟翊翌翎耜聃聆聊聋职聍胬脖脘脚脞脬脯脱脲脶脸舂舳舴舵舶舷舸船舻艴菀菁菅菇菊菌菏菔菖菘菜菝菟菠菡菥菩菪菰菱菲菸菹菽萁萃萄萆萋萌萍萎萏萑萘萜萝萤营萦萧萨萸著虚蚯蚰蚱蚴蚵蚶蚺蛀蛄蛆蛇蛉蛊蛋蛎蛏衅衔袈袋袤袭袱袷袼裆裉觋觖谋谌谍谎谏谐谑谒谓谔谕谖谗谘谙谚谛谜谝豉豚象赇赈赉赊赦赧趺趼趾跃跄距躯辄辅辆逭逮逯逵逶逸逻郾鄂鄄酗酚酝酞野铐铑铒铕铖铗铘铙铛铜铝铞铟铠铡铢铣铤铥铧铨铩铪铫铬铭铮铯铰铱铲铳铴铵银铷阈阉阊阋阌阍阎阏阐隅隆隈隋隍随隐隗雀雩雪颅领颇颈馄馅馆馗骐骑骒骓骖鸷鸸鸹鸺鸽鸾鸿鹿麸麻黄龚描珺堃產琍崑啰晞谞硚琇焗埼菂採馃偲琎啟啲堌捯珵惇棻堉",
"12": "亵傅傈傍傣傥傧储傩傲凿剩割募博厥厦厨啻啼啾喀喁喂喃善喇喈喉喊喋喑喔喘喙喜喝喟喧喱喳喷喹喻喽喾嗖嗟堙堞堠堡堤堪堰塄塔壹奠奥婷婺婿媒媚媛媪嫂孱孳富寐寒寓尊就属屡崴崽崾嵇嵋嵌嵘嵛嵝嵫嵬嵯巯巽帽幂幄幅弑强弼彘彭御徨循悲惑惠惩惫惰惴惶惹惺愀愉愎愕愠愣愤愦愧慌慨戟戢扉掌掣掰掾揄揆揉揍揎提插揖揞揠握揣揩揪揭揲援揸揽揿搀搁搂搅搓搔搜搭搽摒敞散敦敬斌斐斑斯普景晰晴晶晷智晾暂暑曾替最朝期棉棋棍棒棕棘棚棠棣森棰棱棵棹棺棼椁椅椋植椎椐椒椟椠椤椭椰楗楮榔欹欺款殖殚殛毯毳毵毽氮氯氰淼渝渡渣渤渥温渫渭港渲渴游渺湃湄湍湎湓湔湖湘湛湟湫湮湾湿溃溅溆溉溲滁滋滑滞焙焚焦焯焰焱然煮牌牍犀犄犊犋犍猢猥猩猬猱猴猸猹猾琚琛琢琥琦琨琪琬琮琰琳琴琵琶琼瑛瓿甥甯番畲畴疏痘痛痞痢痣痤痦痧痨痪痫登皓皖皴睃睇睐睑矬短硝硪硫硬确硷祺禄禅禽稀稂稃程稍税窖窗窘窜窝竣童竦筅等筋筌筏筐筑筒答策筘筚筛筝筵粞粟粢粤粥粪紫絮絷缂缃缄缅缆缇缈缉缋缌缎缏缑缒缓缔缕编缗缘羡翔翕翘耋耠聒联脔脾腆腈腊腋腌腑腓腔腕腙腚腱腴舄舒舜舾艇萱萼落葆葑葙葚葛葜葡董葩葫葬葭葱葳葵葶葸葺蒂蒇蒈蒉蒋蒌蒎蛐蛑蛔蛘蛙蛛蛞蛟蛤蛩蛭蛮蛰蛱蛲蛳蛴蜒蜓街裁裂装裎裒裕裙裢裣裤裥覃觌觚觞詈谟谠谡谢谣谤谥谦谧貂赋赌赍赎赏赐赓赔赕趁趄超越趋跆跋跌跎跏跑跖跗跚跛跞践辇辈辉辊辋辍辎辜逼逾遁遂遄遇遍遏遐遑遒道遗酡酢酣酤酥釉释量铸铹铺铼铽链铿销锁锂锃锄锅锆锇锈锉锊锋锌锍锎锏锐锑锒锓锔锕阑阒阔阕隔隘隙雁雄雅集雇雯雳靓韩颉颊颌颍颏飓飧飨馇馈馊馋骗骘骚骛鱿鲁鲂鹁鹂鹃鹄鹅鹆鹇鹈黍黑黹鼋鼎嗒皙喆犇湉焜圏甦復萩畬琹棪鹀嗞椪翚註堺",
"13": "戡缙催傺傻像剽剿勤叠嗄嗅嗉嗌嗍嗑嗓嗔嗜嗝嗡嗣嗤嗥嗦嗨嗪嗫嗬嗯嗲嗳嗵嗷嘟塌塍塑塘塞塥填塬墓媲媳媵媸媾嫁嫉嫌嫒嫔嫫寝寞尴嵊嵩嵴幌幕廉廒廓彀徭微想愁愆愈愍意愚感愫慈慊慎慑戤戥搋搌搏搐搛搞搠搡搦搪搬携摁摄摅摆摇摈摊摸敫数斟新旒暄暇暌暖暗椴椹椽椿楂楔楚楝楞楠楣楦楫楱楷楸楹楼榀概榄榆榇榈榉榘槌槎槐歃歆歇殿毁毂毹氲溏源溘溜溟溢溥溧溪溯溱溴溶溷溺溻溽滂滇滏滓滔滗滚滟滠满滢滤滥滦滨滩漓漠漭煅煊煌煎煜煞煤煦照煨煲煳煸煺牒犏献猷猿瑁瑕瑗瑙瑚瑜瑞瑟瑰甄畸畹痰痱痴痹痼痿瘀瘁瘃瘅瘐盟睚睛睡睢督睥睦睨睫睬睹瞄矮硼碇碉碌碍碎碑碓碗碘碚碛碜碰禀禁禊福稔稗稚稞稠稣窟窠窥窦筠筢筮筱筲筷筹筻签简粮粱粲粳缚缛缜缝缟缠缡缢缣缤罨罩罪置署群羧耢聘肄肆腠腥腧腩腭腮腰腹腺腻腼腽腾腿舅艄艉蒗蒙蒜蒡蒯蒲蒴蒸蒹蒺蒽蒿蓁蓄蓉蓊蓍蓐蓑蓓蓖蓝蓟蓠蓣蓥蓦蓬虞蛸蛹蛾蜂蜃蜇蜈蜉蜊蜍蜕蜗蜣衙裔裘裟裨裰裱裸裼裾褂褚觎觜解觥触訾詹誉誊谨谩谪谫谬豢貅貉貊赖趑趔跟跣跤跨跪跫跬路跳跷跸跹跺跻躲辏辐辑输辔辞辟遘遛遢遣遥遨鄙鄞鄢鄣酩酪酬酮酯酰酱鉴锖锗锘错锚锛锝锞锟锡锢锣锤锥锦锨锩锪锫锬锭键锯锰锱阖阗阙障雉雍雎雏零雷雹雾靖靳靴靶韪韫韵颐频颓颔颖飕馍馏馐骜骝骞骟骰骱髡魁魂鲅鲆鲇鲈鲋鲍鲎鲐鹉鹊鹋鹌鹎鹏鹑麂鼓鼠龃龄龅龆蜀滘勠瑄嬅漷碁榅窣塱塚鄠瑀榊蓢暐跶",
"14": "歌獒僖僚僦僧僬僭僮僳儆兢凳劁劂厮嗽嗾嘀嘁嘈嘉嘌嘎嘏嘘嘛嘞嘣嘤嘧塾墁境墅墉墒墙墚夤夥嫖嫘嫜嫠嫡嫣嫦嫩嫱孵察寡寤寥寨屣嶂幔幛廑廖弊彰愿慕慝慢慵慷截戬搴搿摔摘摞摧摭摹摺撂撄撇撖敲斡旖旗暝暧暨榍榕榛榜榧榨榫榭榱榴榷榻槁槊槔槛槟槠模歉殡毓滴滹漂漆漉漏演漕漤漩漪漫漯漱漳漶漾潆潇潋潍潢潴澉煽熄熊熏熔熘熙熬犒獍獐瑭瑶瑷璃甍疑瘊瘌瘕瘗瘘瘙瘟瘥瘦瘩睽睾睿瞀瞅瞍碟碡碣碥碧碱碲碳碴碹磁磋禚稳窨窬窭竭端箅箍箐箔箕算箜箝管箢箦箧箨箩箪箫箬箸粹粼粽精糁綦綮缥缦缧缨缩缪缫罂罱罴翟翠翡翥耥聚肇腐膀膂膈膊膏膑膜臧舆舔舞艋蓰蓼蓿蔌蔑蔓蔗蔚蔟蔡蔫蔷蔸蔹蔺蔻蔼蔽蕖蜘蜚蜜蜞蜡蜢蜥蜩蜮蜱蜴蜷蜻蜾蜿蝇蝈蝉螂裳裴裹褊褐褓褙褛褡褪觏觫誓谭谮谯谰谱谲豪貌赘赙赚赛赫跽踅踉踊踌辕辖辗辣遭遮鄯鄱酲酴酵酶酷酸酹酽酾酿銎銮锲锴锵锶锷锸锹锺锻锼锾锿镀镁镂镄镅阚隧雌雒需霁霆静靼鞅韬韶颗馑馒骠骡骢骶骷髦魃魄魅鲑鲒鲔鲕鲚鲛鲜鲞鲟鹕鹗鹘鹚鹛鹜麽鼐鼻龇龈墟暮槃頔嫚徳嘚粿漈僰漖製槙樋",
"15": "槭僵僻儇儋凛劈劐勰嘬嘭嘱嘲嘶嘹嘻嘿噌噍噎噔噗噘噙噜噢噶墀增墨墩嬉寮履屦嶙嶝幞幡幢廛影徵德慧慰憋憎憔憧憨憬懂戮摩撅撑撒撕撙撞撤撩撬播撮撰撵撷撸撺擒敷暴暹槲槽槿樊樗樘樟横樯樱橄橡橥毅滕潘潜潦潭潮潲潸潺潼澄澈澌澍澎澜澳熟熠熨熳熵牖獗獠瑾璀璁璇璋璎璜畿瘛瘠瘢瘤瘪瘫瘼瞌瞎瞑瞒瞢碾磅磉磊磐磔磕磙稷稹稻稼稽稿窳箭箱箴篁篆篇篌篑篓糅糇糈糊糌糍缬缭缮缯羯羰翦翩耦耧聩聪膘膛膝膣艏艘蔬蕃蕈蕉蕊蕙蕞蕤蕨蕲蕴蕺虢蝌蝎蝓蝗蝙蝠蝣蝤蝥蝮蝰蝴蝶蝻蝼蝽蝾螋褒褥褫褴觐觑觯谳谴谵豌豫赜赭趟趣踏踔踝踞踟踢踣踩踪踬踮踯踺躺辘遴遵醅醇醉醋醌鋈镆镇镉镊镌镍镎镏镐镑镒镓镔霄震霈霉靠靥鞋鞍鞑鞒题颚颛颜额飘餍馓馔骣骸骺骼髫髯魇鲠鲡鲢鲣鲤鲥鲦鲧鲨鲩鲫鹞鹣鹤麾黎齑龉龊懊镕頫慜樑鋆潟禤噁奭鋐澂",
"16": "儒冀凝劓嘴噤器噩噪噫噬噱噻噼嚆圜墼壁壅嬖嬗嬴寰廨廪徼憝憩憷憾懈懒懔撼擀擂擅操擎擐擗擞整斓暾樨樵樽樾橇橐橘橙橛橱橹橼檎檠歙殪氅氆氇潞澡澧澶澹激濂濉濑濒熹燃燎燔燕燠燧犟獬獭璞瓢甏甑瘭瘰瘳瘴瘵瘸瘾瘿癀癃盥瞟瞠瞥瞰磨磬磲磺禧穆穑窿篙篚篝篡篥篦篪篮篱篷糕糖糗糙缰缱缲缳缴罹羲翮翰翱耨耩耪聱膦膨膪膳臻蕹蕻蕾薄薅薇薏薛薜薤薨薪薮薯螃螅螈融螓螗螟螨螭螯蟆蟒衡褰褶赝赞赠踱踵踹踽蹀蹁蹂蹄蹉辙辚辨辩遽避邀邂鄹醍醐醑醒醚醛錾镖镗镘镙镛镜镝镞镟隰雕霍霎霏霓霖靛鞔鞘颞颟颠颡飙飚餐髭髹髻魈魉鲭鲮鲰鲱鲲鲳鲴鲵鲶鲷鲸鲺鲻鹦鹧鹨鹾麇麈黉黔默鼽璟赟燊嬛濛璠燚磡窸曌曈錤璘蕗嬢叡霑獴",
"17": "儡嚅嚎嚏嚓壑壕嬲嬷孺嶷徽懋懑懦戴擘擢擤擦曙朦檀檄檐檑檗檩檬濞濠濡濮濯燥燮爵獯璐璨璩甓疃癌癍皤瞧瞩瞪瞬瞳瞵磴磷礁礅穗篼篾簇簋簌簏簖簧糜糟糠縻繁繇罄罅罾羁翳翼膺膻臀臁臂臃臆臊臌艚薰薷薹藁藉藏藐藓螫螬螳螵螺螽蟀蟊蟋蟑蟓蟥襁襄觳謇豁豳貔貘赡赢蹇蹈蹊蹋蹑蹒辫邃邈醢醣鍪镡镢镣镤镥镦镧镨镩镪镫隳霜霞鞠馘骤髀髁魍魏鲼鲽鳃鳄鳅鳆鳇鳊鳋鹩鹪鹫鹬麋黏黛黜黻鼢鼾龋龌龠黝瞭簕",
"18": "冁嚣彝懵戳曛曜檫瀑燹璧癔癖癜癞瞻瞽瞿礓礞簟簦簪糨翻艟藕藜藤藩蟛蟠蟪蟮襟覆謦蹙蹦蹩躇邋醪鎏鏊镬镭镯镰镱雠鞣鞫鞭鞯颢餮馥髂髅鬃鬈鳌鳍鳎鳏鳐鹭鹰黟黠鼬鹱鹮蹚瀍藠",
"19": "嚯孽巅攀攉攒曝瀚瀛瀣爆瓣疆癣礤簸簿籀籁缵羸羹艨藻藿蘅蘑蘧蟹蟾蠃蠊蠓蠖襞襦警谶蹬蹭蹯蹰蹲蹴蹶蹼蹿酃醭醮醯鏖镲霪霭靡鞲鞴颤骥髋髌鬏魑鳓鳔鳕鳖鳗鳘鳙麒麓麴黢黼鼗贇韡",
"20": "璺嚷嚼壤孀巍攘曦瀵瀹灌獾瓒矍籍糯纂耀蘖蘩蠕蠛譬躁躅酆醴醵镳霰颥馨骧鬓魔鳜鳝鳞鳟黥黧黩黪鼍鼯孃鱀龑",
"21": "夔曩灏爝癫礴禳羼蠡蠢赣躏醺鐾露霸霹颦髓鳢麝黯鼙罍",
"22": "囊懿氍瓤穰耱蘸蘼躐躔镶霾饔饕髑鬻鹳龢",
"23": "麟攥攫癯罐趱躜颧鬟鼷鼹齄蠲",
"24": "灞矗蠹衢襻躞鑫囍",
"25": "鬣馕囔戆攮纛",
"26": "蠼",
"27": "",
"28": "",
"29": "",
"30": "爨",
"31": "",
"32": "",
"33": "",
"34": "",
"35": "",
"36": "齉"
}

View File

@ -1,63 +0,0 @@
"use strict";
var dict = require('./stroke-count-jian.json');
var arg = {
simple: 'simple',
trad: 'trad',
array: 'array'
};
var _ = {}; // 工具方法
function initStrokeToWord(cnchar) {
cnchar.strokeToWord = strokeToWord;
cnchar.type.strokeToWord = arg;
_ = cnchar._;
}
function strokeToWord() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var count = args[0];
if (typeof count !== 'number' || parseInt(count) !== count || count <= 0) {
throw new Error('strokeToWord: 输入必须是正整数');
}
args = args.splice(1);
_.checkArgs('strokeToWord', args);
var res = '';
var argRes = {
simple: _.has(args, arg.simple),
trad: _.has(args, arg.trad)
};
if (!argRes.simple && !argRes.trad) {
argRes.simple = argRes.trad = true;
}
if (argRes.simple) {
res += base(count, dict); // 简体
}
if (argRes.trad && _.dict.getTradCount) {
res += base(count, _.dict.getTradCount()); // 繁体
}
if (_.has(args, arg.array)) {
return res.split('');
}
return res;
}
function base(count, dict) {
if (typeof dict[count] === 'undefined') return '';
return dict[count];
}
module.exports = initStrokeToWord;

View File

@ -1,464 +0,0 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _require = require('./spellToWord'),
spellInfo = _require.spellInfo;
var _require2 = require('./util'),
_warn = _require2._warn,
isCnChar = _require2.isCnChar,
has = _require2.has;
var defDict = require('./spell-default.json');
var tones = 'āáǎàōóǒòēéěèīíǐìūúǔùǖǘǚǜ*ńňǹ'; // * 表示n的一声
var noTones = 'aoeiuün';
var arg = {
array: 'array',
low: 'low',
up: 'up',
first: 'first',
poly: 'poly',
tone: 'tone'
};
var _cnchar = null;
function initCnchar(cnchar) {
_cnchar = cnchar;
}
function spell(dict, args) {
var strs = args[0].split('');
args = args.splice(1);
checkArgs('spell', args);
var poly = has(args, arg.poly);
var tone = has(args, arg.tone);
var res = [];
for (var sp in dict) {
// 遍历拼音
var ds = dict[sp];
var pos = ds[0];
for (var i = 0; i < strs.length; i++) {
// 遍历字符数组
var ch = strs[i];
if (isCnChar(ch)) {
// 如果是汉字
var index = ds.indexOf(ch);
if (index !== -1) {
var ssp = getSpell(sp, ds, index, poly, tone, pos); // single spell
if (ssp.poly) {
// 多音字模式 且 当前汉字是多音字
if (!res[i]) {
res[i] = [];
}
res[i].push(ssp.res);
var dsNew = ds;
var n = dsNew.match(new RegExp(ch, 'g')).length;
for (var k = 1; k < n; k++) {
dsNew = dsNew.substr(index + 2);
index = dsNew.indexOf(ch);
res[i].push(getSpell(sp, dsNew, index, poly, tone, pos).res);
}
} else {
if (ssp.isPolyWord) {
// 是多音字 不是多音字模式
if (defDict[ch]) {
// 设置了多音字的默认拼音
ssp.res = removeTone(defDict[ch], tone).spell; // 默认有音调
}
}
res[i] = ssp.res;
strs[i] = '';
}
}
} else if (ch !== '') {
// 如果不是汉字
res[i] = ':' + ch;
}
}
}
dealUpLowFirst(res, args);
for (var _i = 0; _i < strs.length; _i++) {
var item = res[_i];
if (typeof item === 'undefined') {
res[_i] = strs[_i]; // 查不到的汉字返回原字
} else if (typeof item !== 'string') {
res[_i] = "(".concat(res[_i].join('|'), ")");
} else if (item[0] === ':') {
res[_i] = item.substr(1); // 非汉字返回原字符
}
}
if (!has(args, arg.array)) {
res = res.join('');
}
return res;
}
function dealUpLowFirst(res, args) {
if (_cnchar._.poly) {
dealResCase(res, low); // 当启用了 多音词时 需要强制默认小写
// 因为会被覆盖
}
if (has(args, arg.first)) {
dealResCase(res, first);
}
if (has(args, arg.up)) {
dealResCase(res, up);
} else if (!has(args, arg.low)) {
dealResCase(res, upFirst);
}
}
function dealResCase(res, func) {
res.forEach(function (item, i) {
if (typeof item !== 'string') {
item.forEach(function (s, j) {
item[j] = func(s);
});
} else {
if (item[0] !== ':') res[i] = func(item);
}
});
}
function first(s) {
return s[0];
}
function up(s) {
return s.toUpperCase();
}
function upFirst(s) {
return up(s[0]) + s.substr(1);
}
function low(s) {
return s.toLowerCase();
}
function getSpell(spell, str, index, isPoly, isTone, pos) {
var res = {
res: spell,
poly: false
};
var tone = parseInt(str[index + 1]);
res.isPolyWord = tone >= 5;
if (!isPoly && !isTone) {
return res;
}
if (res.isPolyWord) {
// 是多音字
tone -= 5; // 正确的音调
if (isPoly) {
// 既是多音字模式 又是 多音字
res.poly = true;
}
}
if (isTone) {
res.res = setTone(spell, pos, tone);
}
return res;
} // tone=false : 根据有音调的拼音获得无音调的拼音和音调
// tone=true : 返回原拼音
function removeTone(spell, tone) {
if (tone) {
return {
spell: spell
};
}
for (var i = 0; i < spell.length; i++) {
var index = tones.indexOf(spell[i]);
if (index !== -1) {
// 命中
return {
spell: spell.substr(0, i) + noTones[Math.floor(index / 4)] + spell.substr(i + 1),
tone: index % 4 + 1,
index: i + 1
};
}
}
return {
spell: spell,
tone: 0,
index: -1
};
}
function setTone(spell, index, tone) {
if (tone === 0) {
// 轻声
return spell;
}
var p = spell[index];
var toneP = tones[noTones.indexOf(p) * 4 + (tone - 1)];
if (p !== toneP) {
return spell.replace(p, toneP);
}
} // 笔画数
function stroke(dict, args) {
var strs = args[0].split('');
args = args.splice(1);
checkArgs('stroke', args);
for (var i in dict) {
for (var j = 0; j < strs.length; j++) {
if (typeof strs[j] === 'string') {
if (dict[i].indexOf(strs[j]) !== -1) {
strs[j] = parseInt(i);
}
}
}
}
strs.forEach(function (c, i) {
if (typeof c === 'string') {
strs[i] = 0;
}
});
if (!has(args, arg.array)) {
return sumStroke(strs);
}
return strs;
}
function sumStroke(strs) {
var sum = 0;
strs.forEach(function (c) {
sum += c;
});
return sum;
} // spell 所有参数 ["array", "low", "up", "first", "poly", "tone", "simple"]
// simple 禁用繁体字
// stroke 所有参数 ["letter", "shape", "count", "name", "detail", "array", "order", "simple"]
//
var _hasCheck = false;
function checkArgs(type, args, jumpNext) {
if (!_cnchar.check) {
return;
}
if (_hasCheck) {
_hasCheck = false;
return;
}
if (jumpNext) {
_hasCheck = true;
}
var useless = [];
var t = _cnchar.type;
for (var i = args.length - 1; i >= 0; i--) {
var _arg = args[i];
if (!t[type][_arg]) {
useless.push(_arg);
args.splice(i, 1);
}
}
var ignore = [];
var redunt = [];
var check = function check(name, arr) {
if (_typeof(name) === 'object') {
name.forEach(function (item) {
check(item, arr);
});
return;
}
arr = arr || ignore;
if (has(args, name)) {
arr.push(name);
}
};
if (_cnchar.plugins.indexOf('trad') === -1) {
if (has(args, 'simple')) ignore.push('simple');
if (has(args, 'trad')) ignore.push('trad');
}
if (type === 'spell') {
if (has(args, 'up') && has(args, 'low')) {
ignore.push('low');
} // t.spell.origin 表示启用了多音词
// !has(args,'origin') 表示没有禁用多音词
// 此时的 poly 就会被忽略
// if(t.spell.origin && !has(args,'origin') && has(args,'poly')){
// ignore.push('poly');
// }
} else if (type === 'stroke') {
// stroke
if (has(args, 'order')) {
// 笔画顺序模式
check('array', redunt); // detail > shape > name > count > letter 默认值是 letter
if (has(args, 'letter')) {
check(['detail', 'shape', 'name', 'count']);
check('letter', redunt);
} else if (has(args, 'detail')) {
check(['shape', 'name', 'count']);
} else if (has(args, 'shape')) {
check(['name', 'count']);
} else if (has(args, 'name')) {
check(['count']);
}
} else {
// 笔画数模式
check(['detail', 'shape', 'name', 'letter']);
check('count', redunt);
}
} else if (type === 'orderToWord') {
if (has(args, 'match')) {
check(['match-order', 'contain', 'start']);
} else if (has(args, 'match-order')) {
check(['contain', 'start']);
} else if (has(args, 'contain')) {
check(['start']);
}
} else if (type === 'strokeToWord') {} else if (type === 'spellToWord') {} else if (type === 'idiom') {
if (has(args, 'spell')) {
check(['stroke', 'char']);
} else if (has(args, 'stroke')) {
check(['tone', 'char']);
} else {
check(['tone']);
}
} else if (type === 'xhy') {} else if (type === 'radical') {}
warnArgs(useless, '无效', type, args);
warnArgs(ignore, '被忽略', type, args);
warnArgs(redunt, '冗余', type, args);
}
function warnArgs(arr, txt, type, args) {
if (arr.length > 0) {
var mes = "\u4EE5\u4E0B\u53C2\u6570".concat(txt, ":").concat(JSON.stringify(arr), ";");
if (txt === '被忽略' && type === 'stroke' && !has(args, 'order')) {
mes += ' 要启用笔顺模式必须使用 order 参数';
} else {
mes += " \u53EF\u9009\u503C\uFF1A[".concat(Object.keys(_cnchar.type[type]), "]");
}
_warn(mes);
}
} // lv2 => lǘ
function shapeSpell(spell) {
var tones = '01234';
if (tones.indexOf(spell[spell.length - 1]) === -1) {
return spell;
}
return transformTone(spell, true, 'low').spell;
} // lv2 => {spell:'lü', tone: 2, index: 2, isTrans: true}
// lǘ => {spell:'lü', tone: 2, index: 2, isTrans: false}
// needTone = true: lv2 => {spell:'lǘ', tone: 2, index: 2, isTrans: true}
function transformTone(spell, needTone) {
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'low';
if (spell.indexOf('v') !== -1) {
spell = spell.replace('v', 'ü');
}
var tone = spell[spell.length - 1];
var index = -1;
var isTrans = false;
if (parseInt(tone).toString() === tone) {
// lv2
spell = spell.substr(0, spell.length - 1);
var info = spellInfo(spell);
index = info.index;
tone = parseInt(tone);
isTrans = true;
if (needTone) {
spell = setTone(spell, index - 1, tone);
}
} else {
// lǘ
var _info = spellInfo(spell);
index = _info.index;
tone = _info.tone; // 声调已经带好了的情况
if (!needTone && tone !== 0) {
// 需要去除音调并且有音调
spell = _info.spell;
}
}
if (type === 'low') {
spell = spell.toLowerCase();
} else if (type === 'up') {
spell = spell.toUpperCase();
}
return {
spell: spell,
tone: tone,
index: index,
isTrans: isTrans
};
}
module.exports = {
shapeSpell: shapeSpell,
arg: arg,
spell: spell,
stroke: stroke,
dealUpLowFirst: dealUpLowFirst,
removeTone: removeTone,
sumStroke: sumStroke,
checkArgs: checkArgs,
initCnchar: initCnchar,
tones: tones,
transformTone: transformTone
};

View File

@ -1,59 +0,0 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var infoDict = require('./info-dict.json');
function mapJson(key, value, cb) {
if (_typeof(key) === 'object') {
for (var k in key) {
cb(k, key[k]);
}
return;
}
cb(key, value);
}
function isCnChar(word) {
var unicode = word.charCodeAt(0);
return unicode >= 19968 && unicode <= 40869;
}
function has(args, name) {
return args.indexOf(name) !== -1;
}
function isPolyWord(word) {
if (!word) {
return false;
}
if (word.length > 1) {
word = word[0];
}
if (!isCnChar(word)) {
return false;
}
return infoDict.polyWord.indexOf(word) !== -1;
}
function _throw(err) {
throw new Error('CnChar Error:' + err);
}
function _warn(err) {
console.warn('CnChar Warning:' + err);
}
module.exports = {
mapJson: mapJson,
isCnChar: isCnChar,
has: has,
isPolyWord: isPolyWord,
_throw: _throw,
_warn: _warn
};

View File

@ -1,3 +0,0 @@
"use strict";
module.exports = '2.2.8';

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 - present theajack <contact@theajack.com>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,123 +0,0 @@
"use strict";
var TYPE = {
NORMAL: 'normal',
ANIMATION: 'animation',
STROKE: 'stroke',
TEST: 'test'
};
var TEST_STATUS = {
MISTAKE: 'mistake',
CORRECT: 'correct',
COMPLETE: 'complete'
};
var Option = {
showOutline: true,
showCharacter: true,
currentColor: '#b44',
clear: true,
length: 60,
padding: 5,
// 数值, 默认 20。 画布的汉字和边缘之间的填充
outlineColor: '#ddd',
// 十六进制字符, 默认 '#DDD'。
backgroundColor: '#fff',
strokeColor: '#555',
// 十六进制字符, 默认 '#555'。绘制每个笔划的颜色。
radicalColor: null,
// 十六进制字符, 默认 null。 如果存在偏旁部首数据,则在笔划中绘制偏旁部首的颜色。 如果没有设置,激光将绘制与其他笔划相同的颜色。
strokeFadeDuration: 400,
// 数值, 默认 400。 调用 writer.show() 和 writer.hide() 时在显示和隐藏笔划之间转换的时间(以毫秒为单位)
// 背景line
lineStraight: true,
lineCross: true,
lineWidth: 1,
lineColor: '#ddd',
lineDash: true,
border: true,
borderWidth: 1,
borderColor: '#ccc',
borderDash: false,
// animation
strokeAnimationSpeed: 1,
// 数值, 默认 1。 绘制每个笔划的速度必须大于0。增加此数字可以更快地绘制笔划减少绘制笔划的速度更慢。
delayBetweenStrokes: 1000,
// 数值, 默认 1000。 动画进行中每个笔画之间的间隔时间(以毫秒为单位)。
delayBetweenLoops: 200,
// 数值, 默认 2000。 循环动画时每个动画循环之间的时间(以毫秒为单位)。
autoAnimate: true,
animateComplete: function animateComplete() {},
stepByStep: true,
loopAnimate: false,
// charDataLoader: (a) => {console.log(a);}, // 函数。 自定义函数 加载字符数据 。 有关使用的更多信息,请参阅加载字符数据部分。
// onLoadCharDataSuccess: null, // 函数。 成功加载字符数据时的回调。 使用已加载的数据调用此函数。 这可以用于实现加载微调器。
// onLoadCharDataError: null, // 函数。 字符数据加载失败时的回调。
// test
strokeHighlightSpeed: 20,
// 数值, 默认 20。 在测验中给出提示时突出显示每个笔划的速度必须大于0。增加此数字以突出显示更快减少以突出显示更慢。
highlightColor: '#aaf',
// 十六进制字符, 默认 '#AAF'。 用于在测验中突出显示的颜色。
drawingColor: '#333',
// 十六进制字符, 默认 '#333'。 测验期间绘制的线条颜色。
drawingWidth: 4,
// 数值, 默认 4。 进行测验时绘制的线条宽度。
showHintAfterMisses: 3,
// 整数, 默认 3 中风高亮提示之前的未命中数被给予用户。 设置为 false 以禁用。 创建测验时也可以设置此项。
highlightOnComplete: true,
// 布尔值, 默认 true。 控制当用户完成绘制整个字符时,测验是否会短暂突出显示字符。 创建测验时也可以设置此项。
highlightCompleteColor: null,
// 十六进制字符, 默认 null。 在测验中突出显示字符时使用的颜色。 如果未设置则将使用highlightColor。 仅当highlightOnComplete为true时才相关。
onTestStatus: null // {index, status, data}
};
function isUd(v) {
return typeof v === 'undefined';
}
function merge(type, args) {
var json = {};
for (var key in args) {
var arg = args[key];
for (var k in arg) {
if (!isUd(arg[k])) {
json[k] = arg[k];
}
}
}
check(json);
json.width = json.length;
json.height = json.length;
checkTypeDefault(type, args, json);
return json;
}
function checkTypeDefault(type, args, json) {
if (type === TYPE.ANIMATION) {
if (!args.animation || isUd(args.animation.showCharacter)) {
json.showCharacter = false;
}
} else if (type === TYPE.STROKE) {
json.showCharacter = false;
}
}
function check(json, attrs) {
attrs = attrs || Object.keys(Option);
attrs.forEach(function (attr) {
if (isUd(json[attr])) {
json[attr] = Option[attr];
}
});
return json;
}
module.exports = {
TYPE: TYPE,
Option: Option,
merge: merge,
TEST_STATUS: TEST_STATUS
};

File diff suppressed because it is too large Load Diff

100
npm/draw/index.d.ts vendored
View File

@ -1,100 +0,0 @@
declare type DrawType = 'normal' | 'animation' | 'stroke' | 'test';
declare type TestStatusType = 'mistake' | 'correct' | 'complete';
declare class Writer {
constructor();
option: object;
el: HTMLElement;
type: DrawType;
text: Array<string>;
writer: Array<object>;
animateStart():void;
}
declare interface TestStatus {
index: number,
status: TestStatusType,
data: {
character: string;
totalMistakes: number;// 到目前为止在测验期间犯的总错误。
strokeNum?: number;// 当前笔画数。
mistakesOnStroke?: number;// 到目前为止用户绘制此笔划所犯的错误数。
strokesRemaining?: number;// 测验完成前剩余的笔画数。
drawnPath?: {
pathString: string;
points: Array<{x:number;y:number}>
};// 对象包含用户绘制的 pathString ,用于评分的分数。
}
}
declare interface DrawOption {
el?: string | HTMLElement; // 绘制的容器支持选择器或dom若是不填会在body后append一个dom作为容器
type?: DrawType; // 绘制模式默认为normal
clear?: boolean; // 绘制前是否清空容器 默认为true
style?: { // 样式类
backgroundColor?: string, // 默认为#fff
showOutline?: boolean;//: true,
showCharacter?: boolean;//: true,
currentColor?: string;//: '#b44', // 仅在stroke模式下有效
length?: number;//: 60,
padding?: number;//: 5, // 数值, 默认 20。 画布的汉字和边缘之间的填充
outlineColor?: string;//: '#ddd', // 十六进制字符, 默认 '#DDD'。
strokeColor?: string;//: '#555', // 十六进制字符, 默认 '#555'。绘制每个笔划的颜色。
radicalColor?: string;//: null, // 十六进制字符, 默认 null。 如果存在偏旁部首数据,则在笔划中绘制偏旁部首的颜色。 如果没有设置,激光将绘制与其他笔划相同的颜色。
strokeFadeDuration?: number; //400
},
line?: { // 背景线条类
lineStraight?: boolean;// : true,
lineCross?: boolean;// : true,
lineWidth?: number;// : 1,
lineColor?: string;// : '#ddd',
lineDash?: boolean;// : true,
border?: boolean;// : true,
borderWidth?: number;// : 1,
borderColor?: string;// : '#ccc',
borderDash?: boolean;// : false,
},
animation?: {
strokeAnimationSpeed?: number;// : 1, // 数值, 默认 1。 绘制每个笔划的速度必须大于0。增加此数字可以更快地绘制笔划减少绘制笔划的速度更慢。
delayBetweenStrokes?: number;// : 1000, // 数值, 默认 1000。 动画进行中每个笔画之间的间隔时间(以毫秒为单位)。
delayBetweenLoops?: number;// : 200, // 数值, 默认 2000。 循环动画时每个动画循环之间的时间(以毫秒为单位)。
autoAnimate?: boolean;// : true,
animateComplete?: Function;// : () => {},
stepByStep?: boolean;// : true,
loopAnimate?: boolean;// : false,
},
test?: {
strokeHighlightSpeed?: number;// : 20, // 数值, 默认 20。 在测验中给出提示时突出显示每个笔划的速度必须大于0。增加此数字以突出显示更快减少以突出显示更慢。
highlightColor?: number;// : '#aaf', // 十六进制字符, 默认 '#AAF'。 用于在测验中突出显示的颜色。
drawingColor?: number;// : '#333', // 十六进制字符, 默认 '#333'。 测验期间绘制的线条颜色。
drawingWidth?: number;// : 4, // 数值, 默认 4。 进行测验时绘制的线条宽度。
showHintAfterMisses?: number;// : 3, // 整数, 默认 3 中风高亮提示之前的未命中数被给予用户。 设置为 false 以禁用。 创建测验时也可以设置此项。
highlightOnComplete?: number;// : true, // 布尔值, 默认 true。 控制当用户完成绘制整个字符时,测验是否会短暂突出显示字符。 创建测验时也可以设置此项。
highlightCompleteColor?: number;// : null, // 十六进制字符, 默认 null。 在测验中突出显示字符时使用的颜色。 如果未设置则将使用highlightColor。 仅当highlightOnComplete为true时才相关。
onTestStatus?(args: TestStatus):void;// : null, // ({index, status, data})=>{}
}
}
export declare interface Draw {
(text:string, option?:DrawOption):Writer;
TYPE: {
ANIMATION: 'animation',
NORMAL: 'normal',
STROKE: 'stroke',
TEST: 'test'
},
TEST_STATUS: {
MISTAKE: 'mistake',
CORRECT: 'correct',
COMPLETE: 'complete'
}
}
declare const draw: Draw;
declare module 'cnchar' {
interface CnCharStatic {
draw: Draw;
}
}
export default draw;

View File

@ -1,33 +0,0 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// powerd by hanzi-writer v2.2.2
require('./promise-polyfill');
var draw = require('./writer');
function main(cnchar) {
if (cnchar.plugins.indexOf('draw') !== -1) {
return;
}
cnchar.plugins.push('draw');
cnchar.draw = draw;
}
function init(cnchar) {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object') {
window.CncharDraw = draw;
}
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && window.CnChar) {
main(window.CnChar);
} else if (typeof cnchar !== 'undefined') {
main(cnchar);
}
}
draw.init = init;
init();
module.exports = draw;

View File

@ -1,49 +0,0 @@
"use strict";
/* eslint-disable no-unused-vars */
function buildLinesStr(_ref) {
var width = _ref.width,
lineStraight = _ref.lineStraight,
lineCross = _ref.lineCross,
lineWidth = _ref.lineWidth,
lineColor = _ref.lineColor,
lineDash = _ref.lineDash,
border = _ref.border,
borderWidth = _ref.borderWidth,
borderColor = _ref.borderColor,
borderDash = _ref.borderDash;
var str = '';
var attr = '';
if (lineDash) {
attr += 'stroke-dasharray="8"';
}
if (lineWidth > 1) {
attr += "stroke-width=\"".concat(lineWidth, "\"");
}
if (lineStraight) {
var half = width / 2;
str += "<line x1=\"".concat(half, "\" y1=\"0\" x2=\"").concat(half, "\" y2=\"").concat(width, "\" ").concat(attr, " stroke=\"").concat(lineColor, "\" />\n <line x1=\"0\" y1=\"").concat(half, "\" x2=\"").concat(width, "\" y2=\"").concat(half, "\" ").concat(attr, " stroke=\"").concat(lineColor, "\" />");
}
if (lineCross) {
str += "<line x1=\"0\" y1=\"0\" x2=\"".concat(width, "\" y2=\"").concat(width, "\" ").concat(attr, " stroke=\"").concat(lineColor, "\" />\n <line x1=\"").concat(width, "\" y1=\"0\" x2=\"0\" y2=\"").concat(width, "\" ").concat(attr, " stroke=\"").concat(lineColor, "\" />");
}
var _border = '';
if (border) {
_border = "".concat(borderWidth, "px ").concat(borderDash ? 'dashed' : 'solid', " ").concat(borderColor);
}
return {
lineHTML: str,
border: _border
};
}
module.exports = {
buildLinesStr: buildLinesStr
};

View File

@ -1,176 +0,0 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/**
* Promise-pollfill 兼容ie低版本
*/
!function (e, n) {
'object' == (typeof exports === "undefined" ? "undefined" : _typeof(exports)) && 'undefined' != typeof module ? n() : 'function' == typeof define && define.amd ? define(n) : n();
}(0, function () {
'use strict';
function e(e) {
var n = this.constructor;
return this.then(function (t) {
return n.resolve(e()).then(function () {
return t;
});
}, function (t) {
return n.resolve(e()).then(function () {
return n.reject(t);
});
});
}
function n(e) {
return !(!e || 'undefined' == typeof e.length);
}
function t() {}
function o(e) {
if (!(this instanceof o)) throw new TypeError('Promises must be constructed via new');
if ('function' != typeof e) throw new TypeError('not a function');
this._state = 0, this._handled = !1, this._value = undefined, this._deferreds = [], c(e, this);
}
function r(e, n) {
for (; 3 === e._state;) {
e = e._value;
}
0 !== e._state ? (e._handled = !0, o._immediateFn(function () {
var t = 1 === e._state ? n.onFulfilled : n.onRejected;
if (null !== t) {
var o;
try {
o = t(e._value);
} catch (r) {
return void f(n.promise, r);
}
i(n.promise, o);
} else (1 === e._state ? i : f)(n.promise, e._value);
})) : e._deferreds.push(n);
}
function i(e, n) {
try {
if (n === e) throw new TypeError('A promise cannot be resolved with itself.');
if (n && ('object' == _typeof(n) || 'function' == typeof n)) {
var t = n.then;
if (n instanceof o) return e._state = 3, e._value = n, void u(e);
if ('function' == typeof t) return void c(function (e, n) {
return function () {
e.apply(n, arguments);
};
}(t, n), e);
}
e._state = 1, e._value = n, u(e);
} catch (r) {
f(e, r);
}
}
function f(e, n) {
e._state = 2, e._value = n, u(e);
}
function u(e) {
2 === e._state && 0 === e._deferreds.length && o._immediateFn(function () {
e._handled || o._unhandledRejectionFn(e._value);
});
for (var n = 0, t = e._deferreds.length; t > n; n++) {
r(e, e._deferreds[n]);
}
e._deferreds = null;
}
function c(e, n) {
var t = !1;
try {
e(function (e) {
t || (t = !0, i(n, e));
}, function (e) {
t || (t = !0, f(n, e));
});
} catch (o) {
if (t) return;
t = !0, f(n, o);
}
}
var a = setTimeout;
o.prototype['catch'] = function (e) {
return this.then(null, e);
}, o.prototype.then = function (e, n) {
var o = new this.constructor(t);
return r(this, new function (e, n, t) {
this.onFulfilled = 'function' == typeof e ? e : null, this.onRejected = 'function' == typeof n ? n : null, this.promise = t;
}(e, n, o)), o;
}, o.prototype['finally'] = e, o.all = function (e) {
return new o(function (t, o) {
function r(e, n) {
try {
if (n && ('object' == _typeof(n) || 'function' == typeof n)) {
var u = n.then;
if ('function' == typeof u) return void u.call(n, function (n) {
r(e, n);
}, o);
}
i[e] = n, 0 == --f && t(i);
} catch (c) {
o(c);
}
}
if (!n(e)) return o(new TypeError('Promise.all accepts an array'));
var i = Array.prototype.slice.call(e);
if (0 === i.length) return t([]);
for (var f = i.length, u = 0; i.length > u; u++) {
r(u, i[u]);
}
});
}, o.resolve = function (e) {
return e && 'object' == _typeof(e) && e.constructor === o ? e : new o(function (n) {
n(e);
});
}, o.reject = function (e) {
return new o(function (n, t) {
t(e);
});
}, o.race = function (e) {
return new o(function (t, r) {
if (!n(e)) return r(new TypeError('Promise.race accepts an array'));
for (var i = 0, f = e.length; f > i; i++) {
o.resolve(e[i]).then(t, r);
}
});
}, o._immediateFn = 'function' == typeof setImmediate && function (e) {
setImmediate(e);
} || function (e) {
a(e, 0);
}, o._unhandledRejectionFn = function (e) {
void 0 !== console && console && console.warn('Possible Unhandled Promise Rejection:', e);
};
var l = function () {
if ('undefined' != typeof self) return self;
if ('undefined' != typeof window) return window;
if ('undefined' != typeof global) return global;
throw Error('unable to locate global object');
}();
'Promise' in l ? l.Promise.prototype['finally'] || (l.Promise.prototype['finally'] = e) : l.Promise = o;
});

View File

@ -1,70 +0,0 @@
"use strict";
var HanziWriter = require('./hanzi-writer');
function stroke(writer, cloneSvg) {
writer.text.forEach(function (s) {
var target = document.createElement('div');
writer.el.appendChild(target);
HanziWriter.loadCharacterData(s).then(function (charData) {
for (var i = 0; i < charData.strokes.length; i++) {
renderFanningStrokes({
option: writer.option,
target: target,
strokes: charData.strokes,
radStrokes: charData.radStrokes || [],
current: i,
cloneSvg: cloneSvg,
width: writer.option.width
});
}
});
});
}
function renderFanningStrokes(_ref) {
var option = _ref.option,
target = _ref.target,
strokes = _ref.strokes,
radStrokes = _ref.radStrokes,
cloneSvg = _ref.cloneSvg,
current = _ref.current,
width = _ref.width;
var radicalColor = radStrokes.length > 0 && option.radicalColor ? option.radicalColor : null;
var svg = cloneSvg(option);
target.appendChild(svg);
var group = document.createElementNS('http://www.w3.org/2000/svg', 'g');
var transformData = HanziWriter.getScalingTransform(width, width, option.padding);
group.setAttributeNS(null, 'transform', transformData.transform);
svg.appendChild(group);
for (var i = 0; i <= current; i++) {
var color = option.strokeColor;
if (i === current && option.currentColor) {
color = option.currentColor;
} else if (radicalColor && radStrokes.indexOf(i) !== -1) {
color = radicalColor;
}
renderPath(strokes[i], group, color);
}
if (option.showOutline && current + 1 <= strokes.length) {
for (var _i = current + 1; _i < strokes.length; _i++) {
renderPath(strokes[_i], group, option.outlineColor);
}
}
}
function renderPath(strokePath, group, color) {
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
path.setAttributeNS(null, 'd', strokePath); // style the character paths
path.style.fill = color;
group.appendChild(path);
}
module.exports = {
stroke: stroke
};

View File

@ -1,23 +0,0 @@
"use strict";
function isCnChar(word) {
var unicode = word.charCodeAt(0);
return unicode >= 19968 && unicode <= 40869;
}
function pickCnChar(text) {
var v = '';
for (var i = 0; i < text.length; i++) {
if (isCnChar(text[i])) {
v += text[i];
}
}
return v;
}
module.exports = {
isCnChar: isCnChar,
pickCnChar: pickCnChar
};

View File

@ -1,310 +0,0 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var HanziWriter = require('./hanzi-writer');
var _require = require('./default-option'),
TYPE = _require.TYPE,
merge = _require.merge,
TEST_STATUS = _require.TEST_STATUS;
var _require2 = require('./util'),
pickCnChar = _require2.pickCnChar;
var _require3 = require('./line'),
buildLinesStr = _require3.buildLinesStr;
var _require4 = require('./stroke'),
stroke = _require4.stroke;
var document = (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' ? window.document || null : null;
var svg = function () {
if (!document) {
return null;
}
return document.createElementNS('http://www.w3.org/2000/svg', 'svg');
}();
var Writer = /*#__PURE__*/function () {
function Writer(_ref) {
var _ref$el = _ref.el,
el = _ref$el === void 0 ? 'cnchar-draw' : _ref$el,
_ref$text = _ref.text,
text = _ref$text === void 0 ? '' : _ref$text,
_ref$clear = _ref.clear,
clear = _ref$clear === void 0 ? true : _ref$clear,
_ref$type = _ref.type,
type = _ref$type === void 0 ? TYPE.NORMAL : _ref$type,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
_ref$line = _ref.line,
line = _ref$line === void 0 ? {} : _ref$line,
_ref$animation = _ref.animation,
animation = _ref$animation === void 0 ? {} : _ref$animation,
_ref$stroke = _ref.stroke,
stroke = _ref$stroke === void 0 ? {} : _ref$stroke,
_ref$test = _ref.test,
test = _ref$test === void 0 ? {} : _ref$test;
_classCallCheck(this, Writer);
this.type = type;
this.writers = [];
this.text = text.split('');
var opts = {
style: style,
line: line
};
switch (type) {
case TYPE.ANIMATION:
opts.animation = animation;
break;
case TYPE.STROKE:
opts.stroke = stroke;
break;
case TYPE.TEST:
opts.test = test;
break;
}
this.option = merge(type, opts);
this.el = typeof el === 'string' ? document.querySelector(el) : el;
if (this.el && clear) {
this.el.innerHTML = '';
}
if (!this.el) {
this.el = document.createElement('div');
document.body.appendChild(this.el);
}
this.init();
}
_createClass(Writer, [{
key: "init",
value: function init() {
var _this = this;
var _buildLinesStr = buildLinesStr(this.option),
lineHTML = _buildLinesStr.lineHTML,
border = _buildLinesStr.border;
var cloneSvg = function cloneSvg(option) {
var node = svg.cloneNode();
node.setAttribute('width', _this.option.width);
node.setAttribute('height', _this.option.height);
if (border) {
node.style.border = border;
}
if (lineHTML) {
node.innerHTML = lineHTML;
}
if (option.backgroundColor) {
node.style.backgroundColor = option.backgroundColor;
}
return node;
};
if (this.type === TYPE.STROKE) {
stroke(this, cloneSvg);
} else {
this.text.forEach(function (v) {
var node = cloneSvg(_this.option);
_this.writers.push(HanziWriter.create(node, v, _this.option));
_this.el.appendChild(node);
});
if (this.type === TYPE.ANIMATION) {
var isStart = false;
this.animateStart = function () {
if (isStart) {
return;
}
isStart = true;
if (_this.option.loopAnimate) {
_this.loopAnimate();
} else {
_this.animate(_this.option.animateComplete);
}
};
if (this.option.autoAnimate) {
this.animateStart();
} else {
var start = function start() {
_this.animateStart();
_this.el.removeEventListener('click', start, false);
};
this.el.addEventListener('click', start, false);
}
} else if (this.type === TYPE.TEST) {
var opt = function opt() {
return {};
};
var fn = this.option.onTestStatus;
if (typeof fn === 'function') {
opt = function opt(index) {
return {
onMistake: function onMistake(strokeData) {
fn({
index: index,
status: TEST_STATUS.MISTAKE,
data: strokeData
});
},
onCorrectStroke: function onCorrectStroke(strokeData) {
fn({
index: index,
status: TEST_STATUS.CORRECT,
data: strokeData
});
},
onComplete: function onComplete(summaryData) {
fn({
index: index,
status: TEST_STATUS.COMPLETE,
data: summaryData
});
}
};
};
}
this.writers.forEach(function (writer, index) {
writer.quiz(opt(index));
});
}
}
}
}, {
key: "animate",
value: function animate(complete) {
var _this2 = this;
var opt = this.option;
if (opt.stepByStep) {
// 汉字之间连续绘制
if (opt.showCharacter === false) {
this.writers.forEach(function (writer) {
writer.hideCharacter();
});
}
this._animateStep(0, complete);
} else {
(function () {
// 汉字一起绘制,笔画最多的绘制完成才算全部绘制完成
var index = 0;
for (var i = 0; i < _this2.writers.length; i++) {
_this2._animateSingle(i, function () {
index++;
if (index === _this2.writers.length) {
complete();
}
});
}
})();
}
}
}, {
key: "loopAnimate",
value: function loopAnimate() {
var _this3 = this;
var opt = this.option;
this.animate(function () {
opt.animateComplete();
setTimeout(function () {
_this3.loopAnimate();
}, opt.delayBetweenStrokes);
});
} // animate单个汉字
}, {
key: "_animateSingle",
value: function _animateSingle(i, complete) {
if (i >= this.writers.length) {
complete(true);
return;
}
this.writers[i].animateCharacter({
onComplete: function onComplete() {
complete(false);
}
});
}
}, {
key: "_animateStep",
value: function _animateStep(index, complete) {
var _this4 = this;
this._animateSingle(index, function (end) {
if (!end) {
setTimeout(function () {
_this4._animateStep(index + 1, complete);
}, _this4.option.delayBetweenStrokes);
} else {
complete();
}
});
}
}]);
return Writer;
}(); // eslint-disable-next-line no-unused-vars
function draw() {
var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (typeof window === 'undefined') {
console.error('Draw 方法仅支持在浏览器环境下使用');
return null;
}
text = pickCnChar(text);
if (!text) {
throw new Error('Draw 方法text必须含有中文');
}
options.text = text;
return new Writer(options);
}
;
draw.TYPE = TYPE;
draw.TEST_STATUS = TEST_STATUS;
module.exports = draw;

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 - present theajack <contact@theajack.com>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,36 +0,0 @@
# [hanzi-util-base](https://github.com/theajack/cnchar)
#### [theajack](https://www.theajack.com/)
### 功能全面、多端支持的汉字拼音笔画js库
[api详细文档地址](https://www.theajack.com/cnchar/)
----
[TOC]
----
词库为cnchar的基础功能版本
```
npm i hanzi-util-base
```
### 1.功能
1. 获取 **汉字拼音** ,支持首字母、大小写、数组分割、备选 **多音字** 等功能
2. 支持 **多音词**
3. 支持 **拼音音调**
4. 获取汉字 **笔画数** 、支持数组分割
5. 获取汉字 **笔画顺序** 、笔画详细名称、通过笔画顺序推出原汉字等
6. 支持 **简体字****繁体字****火星文** 互转
7. 支持 **查找** 某拼音的所有 **汉字** ,繁体字,多音字
8. 支持 **查找** 指定笔画数的所有 **汉字** ,繁体字
9. 支持 **查询拼音的信息**,包含声母、韵母、音调、音调位置的等
10. 支持 **繁体字** 拼音、笔画数及以上所有功能,实现和简体字一样的功能
11. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
12. **多端可用**,可用于 原生浏览器环境、webpack 环境、nodejs 环境...,几乎支持所有 js 能运行的环境
13. 丰富的配置,按需取用
### 2.详细文档
[cnchar](https://github.com/theajack/cnchar/blob/master/README.md#cnchar)

View File

@ -1,8 +0,0 @@
declare type spellArg = 'array' | 'low' | 'up' | 'first' | 'poly' | 'tone' | 'simple' | 'trad';
declare type strokeArg = 'letter' | 'shape' | 'count' | 'name' | 'detail' | 'array' | 'order' | 'simple' | 'trad';
interface String {
spell(...args: Array<spellArg>): string | Array<any>;
stroke(...args: Array<strokeArg>): number | Array<any>;
}

File diff suppressed because one or more lines are too long

View File

@ -1,66 +0,0 @@
import './extend';
declare type spellArg = 'array' | 'low' | 'up' | 'first' | 'poly' | 'tone' | 'simple' | 'trad';
declare type strokeArg = 'letter' | 'shape' | 'count' | 'name' | 'detail' | 'array' | 'order' | 'simple' | 'trad';
declare type spellToWordArg = 'poly' | 'alltone' | 'array' | 'simple' | 'trad';
declare type strokeToWordArg = 'array' | 'simple' | 'trad';
declare type pluginArg = 'order' | 'trad' | 'poly' | 'draw' | 'idiom' | 'xhy' | 'radical';
declare type toneType = 0 | 1 | 2 | 3 | 4;
declare type compareType = 'more' | 'less' | 'even';
declare interface spellInfoReturnStatic {
spell: string;
initial: string;
final: string;
tone: number;
index: number;
}
export declare interface CnCharStatic {
spell(sentence: string, ...args: Array<spellArg>): string | Array<any>;
stroke(sentence: string, ...args: Array<strokeArg>): number | Array<any>;
use(...plugins: Array<Function>): void;
spellToWord(spell: string, ...args: Array<spellToWordArg>): string | Array<string>;
strokeToWord(stroke: number, ...args: Array<strokeToWordArg>): string | Array<string>;
spellInfo: {
(spell: string): spellInfoReturnStatic;
tones: Array<string>;
initials: Array<string>;
};
plugins: Array<pluginArg>;
type: {
spell: object;
stroke: object;
spellToWord: object;
strokeToWord: object;
orderToWord?: object;
idiom?: object;
xhy?: object;
radical?: object;
};
check: boolean;
readonly version: string;
transformTone(spell: string, tone?: boolean, type?: 'low' | 'up'): {
spell: string;
tone: toneType;
index: number;
isTrans: boolean;
};
isCnChar(word: string): boolean;
isPolyWord(word: string): boolean;
compareSpell(spell1: string, spell2: string, tone?: boolean): compareType;
compareStroke(stroke1: string | number, stroke2: string | number): compareType;
sortSpell(spells:Array<string> | string, ...args: Array<'tone'|'desc'>): Array<string> | string;
sortStroke(strokes:Array<string|number> | string, desc?: 'desc'): Array<string> | string;
setSpellDefault(word: string, spell: string): void;
setSpellDefault(json: {[key: string]: string}): void;
setSpell(word: string, spell: string): void;
setSpell(json: {[key: string]: string}): void;
setStrokeCount(word: string, count: number): void;
setStrokeCount(json: {[key: string]: number}): void;
shapeSpell(spell: string): string;
}
declare const cnchar: CnCharStatic;
export default cnchar;

View File

@ -1,2 +0,0 @@
var cnchar = require('cnchar');
module.exports = cnchar;

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 - present theajack <contact@theajack.com>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,36 +0,0 @@
# [hanzi-util](https://github.com/theajack/cnchar)
#### [theajack](https://www.theajack.com/)
### 功能全面、多端支持的汉字拼音笔画js库
[api详细文档地址](https://www.theajack.com/cnchar/)
----
[TOC]
----
词库为cnchar的完整功能版本
```
npm i hanzi-util
```
### 1.功能
1. 获取 **汉字拼音** ,支持首字母、大小写、数组分割、备选 **多音字** 等功能
2. 支持 **多音词**
3. 支持 **拼音音调**
4. 获取汉字 **笔画数** 、支持数组分割
5. 获取汉字 **笔画顺序** 、笔画详细名称、通过笔画顺序推出原汉字等
6. 支持 **简体字****繁体字****火星文** 互转
7. 支持 **查找** 某拼音的所有 **汉字** ,繁体字,多音字
8. 支持 **查找** 指定笔画数的所有 **汉字** ,繁体字
9. 支持 **查询拼音的信息**,包含声母、韵母、音调、音调位置的等
10. 支持 **繁体字** 拼音、笔画数及以上所有功能,实现和简体字一样的功能
11. **体积小**min 版本仅 46 kbzip 版本 34 kb (含有大量汉字拼音字典)
12. **多端可用**,可用于 原生浏览器环境、webpack 环境、nodejs 环境...,几乎支持所有 js 能运行的环境
13. 丰富的配置,按需取用
### 2.详细文档
[cnchar](https://github.com/theajack/cnchar/blob/master/README.md#cnchar)

View File

@ -1,13 +0,0 @@
declare type spellArgs = 'array' | 'low' | 'up' | 'first' | 'poly' | 'tone' | 'simple' | 'trad';
declare type strokeArgs = 'letter' | 'shape' | 'count' | 'name' | 'detail' | 'array' | 'order' | 'simple' | 'trad';
interface String {
spell(...args: Array<spellArgs>): string | Array<any>;
stroke(...args: Array<strokeArgs>): number | Array<any>;
convertSimpleToTrad(): string;
convertSimpleToSpark(): string;
convertTradToSimple(): string;
convertTradToSpark(): string;
convertSparkToSimple(): string;
convertSparkToTrad(): string;
}

File diff suppressed because one or more lines are too long

View File

@ -1,189 +0,0 @@
// all库的声明文件
import './extend';
// draw
declare type DrawType = 'normal' | 'animation' | 'stroke' | 'test';
declare type TestStatusType = 'mistake' | 'correct' | 'complete';
declare class Writer {
constructor();
option: object;
el: HTMLElement;
type: DrawType;
text: Array<string>;
writer: Array<object>;
animateStart():void;
}
declare interface TestStatus {
index: number,
status: TestStatusType,
data: {
character: string;
totalMistakes: number;// 到目前为止在测验期间犯的总错误。
strokeNum?: number;// 当前笔画数。
mistakesOnStroke?: number;// 到目前为止用户绘制此笔划所犯的错误数。
strokesRemaining?: number;// 测验完成前剩余的笔画数。
drawnPath?: {
pathString: string;
points: Array<{x:number;y:number}>
};// 对象包含用户绘制的 pathString ,用于评分的分数。
}
}
declare interface DrawOption {
el?: string | HTMLElement; // 绘制的容器支持选择器或dom若是不填会在body后append一个dom作为容器
type?: DrawType; // 绘制模式默认为normal
clear?: boolean; // 绘制前是否清空容器 默认为true
style?: { // 样式类
backgroundColor?: string, // 默认为#fff
showOutline?: boolean;//: true,
showCharacter?: boolean;//: true,
currentColor?: string;//: '#b44', // 仅在stroke模式下有效
length?: number;//: 60,
padding?: number;//: 5, // 数值, 默认 20。 画布的汉字和边缘之间的填充
outlineColor?: string;//: '#ddd', // 十六进制字符, 默认 '#DDD'。
strokeColor?: string;//: '#555', // 十六进制字符, 默认 '#555'。绘制每个笔划的颜色。
radicalColor?: string;//: null, // 十六进制字符, 默认 null。 如果存在偏旁部首数据,则在笔划中绘制偏旁部首的颜色。 如果没有设置,激光将绘制与其他笔划相同的颜色。
strokeFadeDuration?: number; //400
},
line?: { // 背景线条类
lineStraight?: boolean;// : true,
lineCross?: boolean;// : true,
lineWidth?: number;// : 1,
lineColor?: string;// : '#ddd',
lineDash?: boolean;// : true,
border?: boolean;// : true,
borderWidth?: number;// : 1,
borderColor?: string;// : '#ccc',
borderDash?: boolean;// : false,
},
animation?: {
strokeAnimationSpeed?: number;// : 1, // 数值, 默认 1。 绘制每个笔划的速度必须大于0。增加此数字可以更快地绘制笔划减少绘制笔划的速度更慢。
delayBetweenStrokes?: number;// : 1000, // 数值, 默认 1000。 动画进行中每个笔画之间的间隔时间(以毫秒为单位)。
delayBetweenLoops?: number;// : 200, // 数值, 默认 2000。 循环动画时每个动画循环之间的时间(以毫秒为单位)。
autoAnimate?: boolean;// : true,
animateComplete?: Function;// : () => {},
stepByStep?: boolean;// : true,
loopAnimate?: boolean;// : false,
},
test?: {
strokeHighlightSpeed?: number;// : 20, // 数值, 默认 20。 在测验中给出提示时突出显示每个笔划的速度必须大于0。增加此数字以突出显示更快减少以突出显示更慢。
highlightColor?: number;// : '#aaf', // 十六进制字符, 默认 '#AAF'。 用于在测验中突出显示的颜色。
drawingColor?: number;// : '#333', // 十六进制字符, 默认 '#333'。 测验期间绘制的线条颜色。
drawingWidth?: number;// : 4, // 数值, 默认 4。 进行测验时绘制的线条宽度。
showHintAfterMisses?: number;// : 3, // 整数, 默认 3 中风高亮提示之前的未命中数被给予用户。 设置为 false 以禁用。 创建测验时也可以设置此项。
highlightOnComplete?: number;// : true, // 布尔值, 默认 true。 控制当用户完成绘制整个字符时,测验是否会短暂突出显示字符。 创建测验时也可以设置此项。
highlightCompleteColor?: number;// : null, // 十六进制字符, 默认 null。 在测验中突出显示字符时使用的颜色。 如果未设置则将使用highlightColor。 仅当highlightOnComplete为true时才相关。
onTestStatus?(args: TestStatus):void;// : null, // ({index, status, data})=>{}
}
}
export declare interface Draw {
(text:string, option?:DrawOption):Writer;
TYPE: {
ANIMATION: 'animation',
NORMAL: 'normal',
STROKE: 'stroke',
TEST: 'test'
},
TEST_STATUS: {
MISTAKE: 'mistake',
CORRECT: 'correct',
COMPLETE: 'complete'
}
}
// idiom
declare type idiomArg = 'char' | 'stroke' | 'spell' | 'tone';
export declare interface Idiom {
(text:string | Array<string|number>, ...idiomArgs: Array<idiomArg>):Array<string>;
}
// order
declare type orderToWordArg = 'match' | 'matchorder' | 'contain' | 'start' | 'array' | 'simple' | 'trad';
declare type orderName = '横折折撇' | '竖弯' | '横折' | '撇点' | '横斜钩' | '横' | '捺' | '横折钩' | '竖' | '竖钩' | '点' | '撇' | '撇折' | '竖折撇' | '横折折折钩' | '竖折折钩' | '提' | '弯钩' | '斜钩' | '横折折' | '横撇' | '横折提' | '横折折折' | '竖提' | '竖弯钩'
| '竖折折' | '横撇弯钩' | '卧钩' | '横折弯' | '横钩';
// xhy
declare type xhyArg = 'fuzzy' | 'answer' | 'second';
export declare interface XHY {
(text:string, ...xhyArgs: Array<xhyArg>):Array<string>;
}
declare type spellArg = 'array' | 'low' | 'up' | 'first' | 'poly' | 'tone' | 'simple' | 'trad';
declare type strokeArg = 'letter' | 'shape' | 'count' | 'name' | 'detail' | 'array' | 'order' | 'simple' | 'trad';
declare type spellToWordArg = 'poly' | 'alltone' | 'array' | 'simple' | 'trad';
declare type strokeToWordArg = 'array' | 'simple' | 'trad';
declare type pluginArg = 'order' | 'trad' | 'poly' | 'draw' | 'idiom' | 'xhy';
declare type toneType = 0 | 1 | 2 | 3 | 4;
declare type compareType = 'more' | 'less' | 'even';
declare interface spellInfoReturnStatic {
spell: string;
initial: string;
final: string;
tone: number;
index: number;
}
export declare interface CnCharStatic {
spell(sentence: string, ...args: Array<spellArg>): string | Array<any>;
stroke(sentence: string, ...args: Array<strokeArg>): number | Array<any>;
use(...plugins: Array<Function>): void;
spellToWord(spell: string, ...args: Array<spellToWordArg>): string | Array<string>;
strokeToWord(stroke: number, ...args: Array<strokeToWordArg>): string | Array<string>;
spellInfo: {
(spell: string): spellInfoReturnStatic;
tones: Array<string>;
initials: Array<string>;
};
plugins: Array<pluginArg>;
type: {
spell: object;
stroke: object;
spellToWord: object;
strokeToWord: object;
orderToWord?: object;
idiom?: object;
xhy?: object;
};
check: boolean;
readonly version: string;
transformTone(spell: string, tone?: boolean, type?: 'low' | 'up'): {
spell: string;
tone: toneType;
index: number;
isTrans: boolean;
};
isCnChar(word: string): boolean;
compareSpell(spell1: string, spell2: string, tone?: boolean): compareType;
compareStroke(stroke1: string | number, stroke2: string | number): compareType;
sortSpell(spells:Array<string> | string, ...args: Array<'tone'|'desc'>): Array<string> | string;
sortStroke(strokes:Array<string|number> | string, desc?: 'desc'): Array<string> | string;
draw: Draw;
idiom: Idiom;
orderToWord: {
(orders: string | Array<orderName>, ...args: Array<orderToWordArg>): string | Array<string>;
orders: object;
};
convert: {
simpleToSpark(sentence: string): string;
simpleToTrad(sentence: string): string;
sparkToSimple(sentence: string): string;
sparkToTrad(sentence: string): string;
tradToSimple(sentence: string): string;
tradToSpark(sentence: string): string;
};
xhy: XHY;
}
declare const cnchar: CnCharStatic;
export default cnchar;

View File

@ -1,2 +0,0 @@
var cnchar = require('cnchar-all');
module.exports = cnchar;

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 - present theajack <contact@theajack.com>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,218 +0,0 @@
"use strict";
/**
* 汉字 ['a','','c','']
* 笔画 [1,0,1,0]
* 拼音 ['shi', '']
*/
// 小程序中json直接放一个数组会有异常所以包一个key
var dict = require('./idiom.json').idiom; // const {initToneCodes, getCharCode} = require('./tone');
var spellDict = require('./spell.json').spell;
var spellNoToneDict = require('./spell.notone.json').spell;
var _cnchar = null;
var arg = {
"char": 'char',
stroke: 'stroke',
spell: 'spell',
tone: 'tone'
}; // spell > stroke > char
// spell 和 stroke 仅在 引入cnchar之后才可用
function idiom() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 0) {
console.warn('idiom: 请输入搜索项');
return;
}
var input = args[0];
args = args.slice(1);
if (args.indexOf(arg.spell) !== -1 && typeof input !== 'string') {
console.warn('idiom spell 模式下仅支持查询首个汉字的拼音');
return;
}
if (!(input instanceof Array || args.indexOf(arg.spell) !== -1 || typeof input === 'number' && args.indexOf(arg.stroke) !== -1)) {
console.warn('idiom 输入参数仅支持数组 或 stroke模式下的数字');
return;
}
var res = null;
if (!_cnchar) {
// 单独使用的idiom 只支持汉字查询方式
checkArg(args, arg.stroke);
checkArg(args, arg.spell);
res = idiomWithChar(input);
} else {
_cnchar._.checkArgs('idiom', args);
if (_cnchar._.has(args, arg.spell)) {
res = idiomWithSpell(input, _cnchar._.has(args, arg.tone));
} else if (_cnchar._.has(args, arg.stroke)) {
res = idiomWithStroke(input);
} else {
res = idiomWithChar(input);
}
}
return res;
}
function idiomWithChar(input) {
return dict.filter(function (item) {
return compareCommon(input, item.split(''));
});
} // needTone是否需要匹配音调
function idiomWithSpell(input, tone) {
// console.log(input, tone);
var total = dict.length;
var _dict = tone ? spellDict : spellNoToneDict;
if (tone) {
input = _cnchar._.transformTone(input, true).spell;
}
var filter = _dict.filter(function (item) {
return input === item.split(':')[0];
});
if (filter.length === 0) {
return [];
}
var res = [];
var n = _dict.length - 1;
filter.forEach(function (item) {
var index = _dict.indexOf(item);
var curDIndex = item.split(':')[1];
var nextDIndex = index === n ? total : _dict[index + 1].split(':')[1];
res = res.concat(dict.slice(curDIndex, nextDIndex));
});
return res; // let low = 0;
// let high = total;
// input = input.toLowerCase();
// if (tone) {
// input = _cnchar._.transformTone(input, 'tone').spell;
// }
// let target = input.split('').map(c => getCharCode(c, tone));
// let area = step1FindArea(low, high, target, tone);
// if (area === TYPE.ERROR) {
// return [];
// }
// let floor = step2FindFloor(area.low, area.mid, target, tone).mid;
// let ceil = step3FindCeil(area.mid, area.high, target, tone).mid;
// return dict.slice(floor, ceil + 1);
} // 二分查找拼音依赖拼音准确率,可能会不准确,故放弃
// function binarySearch (low, high, condition) {
// if (low > high) {
// return TYPE.ERROR;
// }
// let mid = Math.floor((low + high) / 2);
// let res = condition(mid);
// if (res === TYPE.MORE) {
// return binarySearch(low, mid - 1, condition);
// } else if (res === TYPE.LESS) {
// return binarySearch(mid + 1, high, condition);
// } else {
// return {low, high, mid};
// }
// }
// function step1FindArea (low, high, target, tone) { // 找到一个区间,该区间包含所有拼音,且中值为该拼音
// return binarySearch(low, high, (mid) => {
// return _cnchar._.compareSpell(mid, target, tone);
// });
// }
// function step2FindFloor (low, high, target, tone) { // 查找下界
// return binarySearch(low, high, (mid) => {
// return compareBoundary(mid, target, TYPE.MORE, TYPE.LESS, -1, tone);
// });
// }
// function step3FindCeil (low, high, target, tone) { // 查找上界
// return binarySearch(low, high, (mid) => {
// return compareBoundary(mid, target, TYPE.LESS, TYPE.MORE, 1, tone);
// });
// }
// typeCenter 朝区域中心的大小type typeSide 朝区域两端的大小type
// function compareBoundary (mid, target, typeCenter, typeSide, neighborPlus, tone) {
// let res = _cnchar._.compareSpell(mid, target, tone);
// if (res === typeSide) {
// return res;
// }
// if (res === TYPE.EVEN) {
// let neighborIndex = mid + neighborPlus;
// if (neighborIndex < 0 || neighbor >= total) {
// return TYPE.EVEN;
// }
// let neighbor = _cnchar._.compareSpell(neighborIndex, target, tone); // + 1
// if (neighbor === TYPE.EVEN) {
// return typeCenter;
// } else if (neighbor === typeSide) {
// return TYPE.EVEN;
// } else {
// console.error(neighbor);
// throw new Error('idoim Error');
// }
// }
// }
function idiomWithStroke(input) {
if (typeof input === 'number') {
// 总笔画数为多少
return dict.filter(function (item) {
return input === _cnchar.stroke(item);
});
}
return dict.filter(function (item) {
return compareCommon(input, _cnchar.stroke(item, 'array'));
});
}
/**
* ['五','','十',''],['五','光','十','色'] => true
* ['wu','','shi',''],['wu','guang','shi','se'] => true
* [4, 0, 2, 0],[4, 6, 2, 6] => true
*/
//
//
//
function compareCommon(input, target) {
for (var i = 0; i < input.length; i++) {
if (input[i] && input[i] !== target[i]) {
return false;
}
}
return true;
}
function checkArg(args, name) {
if (args.indexOf(name) !== -1) {
console.warn("\u672A\u5F15\u5165cnchar,idiom\u4E0D\u652F\u6301".concat(name, "\u53C2\u6570"));
}
}
function setCnchar(cnchar) {
_cnchar = cnchar; // initToneCodes(cnchar);
}
module.exports = {
idiom: idiom,
arg: arg,
setCnchar: setCnchar
};

File diff suppressed because one or more lines are too long

15
npm/idiom/index.d.ts vendored
View File

@ -1,15 +0,0 @@
declare type idiomArg = 'char' | 'stroke' | 'spell' | 'tone';
export declare interface Idiom {
(text:string | Array<string|number>, ...idiomArgs: Array<idiomArg>):Array<string>;
}
declare const idiom: Idiom;
declare module 'cnchar' {
interface CnCharStatic {
idiom: Idiom;
}
}
export default idiom;

View File

@ -1,36 +0,0 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _require = require('./idiom'),
idiom = _require.idiom,
arg = _require.arg,
setCnchar = _require.setCnchar;
function main(cnchar) {
if (cnchar.plugins.indexOf('idiom') !== -1) {
return;
}
cnchar.plugins.push('idiom');
cnchar.idiom = idiom;
cnchar.type.idiom = arg;
}
function init(cnchar) {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.CncharIdiom) {
window.CncharIdiom = idiom;
}
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && window.CnChar) {
main(window.CnChar);
setCnchar(window.CnChar);
} else if (typeof cnchar !== 'undefined') {
main(cnchar);
setCnchar(cnchar);
}
}
idiom.init = init;
init();
module.exports = idiom;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 - present theajack <contact@theajack.com>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

19
npm/order/index.d.ts vendored
View File

@ -1,19 +0,0 @@
declare const order: Function;
declare type orderToWordArg = 'match' | 'matchorder' | 'contain' | 'start' | 'array' | 'simple' | 'trad';
declare type orderName = '横折折撇' | '竖弯' | '横折' | '撇点' | '横斜钩' | '横' | '捺' | '横折钩' | '竖' | '竖钩' | '点' | '撇' | '撇折' | '竖折撇' | '横折折折钩' | '竖折折钩' | '提' | '弯钩' | '斜钩' | '横折折' | '横撇' | '横折提' | '横折折折' | '竖提' | '竖弯钩'
| '竖折折' | '横撇弯钩' | '卧钩' | '横折弯' | '横钩';
declare module 'cnchar' {
interface CnCharStatic {
orderToWord: {
(orders: string | Array<orderName>, ...args: Array<orderToWordArg>): string | Array<string>;
orders: object;
};
setOrder(word: string, order: string): void;
setOrder(json: {[key: string]: string}): void;
}
}
export default order;

View File

@ -1,166 +0,0 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var orders = require('./stroke-order-jian.json');
var strokeTable = require('./stroke-table.json');
var initOrderToWord = require('./orderToWord.js');
var _ = {}; // 工具方法
var arg = {
letter: 'letter',
shape: 'shape',
count: 'count',
name: 'name',
detail: 'detail',
array: 'array',
order: 'order' // array 只是为了兼容 .stroke()
};
function setOrder(key, value) {
_.mapJson(key, value, function (k, v) {
orders[k] = v;
});
}
function main(cnchar) {
if (cnchar.plugins.indexOf('order') !== -1) {
return;
}
cnchar.plugins.push('order');
var _old = cnchar._origin.stroke;
_ = cnchar._;
cnchar.setOrder = setOrder;
var _new = function _new() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (_.has(args, arg.order)) {
// 使用order
return _order.apply(void 0, args);
}
return _old.apply(void 0, args);
};
cnchar.stroke = _new;
String.prototype.stroke = function () {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return _new.apply(void 0, [this].concat(args));
};
cnchar.type.stroke = arg;
cnchar._.order = true;
cnchar._.orderWithLetters = orderWithLetters;
if (cnchar._reinitStrokeOrder) {
cnchar._reinitStrokeOrder();
delete cnchar._reinitStrokeOrder;
}
initOrderToWord(cnchar);
}
function init(cnchar) {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && window.CnChar) {
main(window.CnChar);
} else if (typeof cnchar !== 'undefined') {
main(cnchar);
}
}
function _order() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
var strs = args[0].split(''); // 待处理的字符串数组
args = args.splice(1);
_.checkArgs('stroke', args); // 多音字参数参数将被忽略
var res = [];
for (var i = 0; i < strs.length; i++) {
res[i] = orders[strs[i]]; // 字母版笔画表
}
return orderWithLetters(res, strs, args);
} // res:字母版笔画数组
function orderWithLetters(res, strs, args, igList) {
igList = igList || [];
if (_.has(args, arg.letter)) {
return res;
}
for (var i = 0; i < res.length; i++) {
if (igList.indexOf(i) === -1 && typeof res[i] === 'string') {
res[i] = getStrokeSingle(strs[i], res[i], args);
}
}
return res;
} // bug CnChar.stroke('長城','order','count')
function getStrokeSingle(str, order, args) {
if (typeof order === 'undefined') {
return str;
}
var isDetail = _.has(args, arg.detail);
var name = arg.letter;
if (!isDetail) {
if (_.has(args, arg.shape)) {
name = arg.shape;
} else if (_.has(args, arg.name)) {
name = arg.name;
} else if (_.has(args, arg.count)) {
name = arg.count;
}
} else {
name = arg.detail;
}
if (name === arg.count) {
return order.length;
}
if (name === arg.letter) {
return order;
}
var arr = [];
for (var i = 0; i < order.length; i++) {
if (isDetail) {
arr[i] = strokeTable[order[i]];
} else {
arr[i] = strokeTable[order[i]][name];
}
}
return arr;
}
init();
module.exports = init;

View File

@ -1,189 +0,0 @@
"use strict";
var orders = require('./stroke-order-jian.json');
var strokeTable = require('./stroke-table.json');
var arg = {
start: 'start',
contain: 'contain',
match: 'match',
matchorder: 'matchorder',
simple: 'simple',
trad: 'trad',
array: 'array'
};
var _ = {}; // 工具方法
function initOrderToWord(cnchar) {
cnchar.orderToWord = orderToWord;
cnchar.type.orderToWord = arg;
_ = cnchar._;
}
function orderToWord() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var orderArr = args[0];
args = args.splice(1);
if (typeof orderArr === 'string') {
orderArr = orderArr.split(' ');
} else if (!orderArr instanceof Array) {
throw new Error('orderToWord: 输入必须是笔画名数组或空格分隔的字符串');
}
_.checkArgs('orderToWord', args);
var errorOrder = [];
var letters = '';
orderArr.forEach(function (name) {
if (orderToWord.orders[name]) {
letters += orderToWord.orders[name].letter;
} else {
errorOrder.push(name);
}
});
if (errorOrder.length > 0) {
console.error('orderToWord: 参数笔画名数组有误:' + errorOrder.join(','));
return [];
}
var res = [];
var argRes = {
start: _.has(args, arg.start),
match: _.has(args, arg.match),
matchorder: _.has(args, arg.matchorder),
contain: _.has(args, arg.contain),
simple: _.has(args, arg.simple),
trad: _.has(args, arg.trad)
};
if (!argRes.simple && !argRes.trad) {
argRes.simple = argRes.trad = true;
}
if (argRes.simple) {
base(res, letters, argRes, orders); // 简体
}
if (argRes.trad && _.dict.getTradOrders) {
base(res, letters, argRes, _.dict.getTradOrders()); // 繁体
}
if (_.has(args, arg.array)) {
return res;
}
return res.join('');
}
function base(res, letters, args, dict) {
// 写多个for循环减少if判断
if (args.match) {
// match 表示只要包含笔画就输出
for (var k in dict) {
var notcontain = false;
for (var i = 0; i < letters.length; i++) {
if (dict[k].indexOf(letters[i]) === -1) {
notcontain = true;
break;
}
}
if (!notcontain) {
res.push(k);
}
}
} else if (args.matchorder) {
// match-order 表示不仅包含所有笔画 而且笔画是按顺序的
for (var _k in dict) {
var _notcontain = false;
var _orders = dict[_k];
for (var _i = 0; _i < letters.length; _i++) {
var index = _orders.indexOf(letters[_i]);
if (index === -1) {
_notcontain = true;
break;
} else {
_orders = _orders.substr(index + 1);
}
}
if (!_notcontain) {
res.push(_k);
}
}
} else if (args.contain) {
// contain 包含笔画顺序壁画顺序开头
for (var _k2 in dict) {
if (dict[_k2].indexOf(letters) !== -1) {
res.push(_k2);
}
}
} else if (args.start) {
// start 表示匹配所有以壁画顺序开头的汉字
for (var _k3 in dict) {
if (dict[_k3].indexOf(letters) === 0) {
res.push(_k3);
}
}
} else {
// 默认是严格匹配笔画序序列
for (var _k4 in dict) {
if (dict[_k4].length > letters.length) {
break;
}
if (dict[_k4] === letters) {
res.push(_k4);
}
}
}
return res;
}
function init() {
orderToWord.orders = {};
orderToWord._base = base;
for (var k in strokeTable) {
var single = strokeTable[k]; // let name = single.name.split('(')[0]; // 有别名时 只取第一个
var name = single.name; // 有别名时 只取第一个
var shape = single.shape; // 2.0.8 修改 保留两个
if (name.indexOf('|') !== -1) {
var names = name.split('|');
var shapes = shape.split('|');
addToOrders(names[0], shapes[0], k, names[1]);
addToOrders(names[1], shapes[1], k, names[0]);
} else {
addToOrders(name, shape, k);
}
}
}
function addToOrders(name, shape, letter, sameLetterTo) {
var data = {
shape: shape,
letter: letter
};
if (sameLetterTo) {
data.sameLetterTo = sameLetterTo;
}
orderToWord.orders[name] = data;
}
init();
module.exports = initOrderToWord;

File diff suppressed because it is too large Load Diff

View File

@ -1,158 +0,0 @@
{
"a": {
"shape": "㇋",
"type": "折笔",
"foldCount": "3",
"name": "横折折撇"
},
"b": {
"shape": "㇄",
"type": "折笔",
"foldCount": "1",
"name": "竖弯"
},
"c": {
"shape": "𠃍",
"type": "折笔",
"foldCount": "1",
"name": "横折"
},
"d": {
"shape": "㇀",
"type": "平笔",
"foldCount": "1",
"name": "撇点"
},
"o": {
"shape": "⺄",
"type": "折笔",
"foldCount": "2",
"name": "横斜钩"
},
"j": {
"shape": "一",
"type": "平笔",
"foldCount": "0",
"name": "横"
},
"l": {
"shape": "㇏",
"type": "平笔",
"foldCount": "0",
"name": "捺"
},
"r": {
"shape": "𠃌",
"type": "折笔",
"foldCount": "2",
"name": "横折钩"
},
"f": {
"shape": "丨",
"type": "平笔",
"foldCount": "0",
"name": "竖"
},
"g": {
"shape": "亅",
"type": "平笔",
"foldCount": "0",
"name": "竖钩"
},
"k": {
"shape": "",
"type": "平笔",
"foldCount": "0",
"name": "点"
},
"s": {
"shape": "丿",
"type": "平笔",
"foldCount": "0",
"name": "撇"
},
"n": {
"shape": "𠃋",
"type": "折笔",
"foldCount": "1",
"name": "撇折"
},
"x": {
"shape": "ㄣ|𠃑",
"type": "折笔",
"foldCount": "2",
"name": "竖折撇|竖折折"
},
"w": {
"shape": "𠄎|㇌",
"type": "折笔",
"foldCount": "4",
"name": "横折折折钩|横撇弯钩"
},
"z": {
"shape": "㇉",
"type": "折笔",
"foldCount": "3",
"name": "竖折折钩"
},
"i": {
"shape": "㇀",
"type": "平笔",
"foldCount": "0",
"name": "提"
},
"t": {
"shape": "㇁",
"type": "折笔",
"foldCount": "1",
"name": "弯钩"
},
"y": {
"shape": "㇂|㇃",
"type": "折笔",
"foldCount": "1",
"name": "斜钩|卧钩"
},
"v": {
"shape": "㇅|㇍",
"type": "折笔",
"foldCount": "2",
"name": "横折折|横折弯"
},
"e": {
"shape": "㇇|乛",
"type": "折笔",
"foldCount": "1",
"name": "横撇|横钩"
},
"p": {
"shape": "㇊",
"type": "折笔",
"foldCount": "2",
"name": "横折提"
},
"q": {
"shape": "㇎",
"type": "折笔",
"foldCount": "3",
"name": "横折折折"
},
"h": {
"shape": "𠄌",
"type": "折笔",
"foldCount": "1",
"name": "竖提"
},
"m": {
"shape": "𡿨",
"type": "折笔",
"foldCount": "1",
"name": "撇点"
},
"u": {
"shape": "乚",
"type": "折笔",
"foldCount": "2",
"name": "竖弯钩"
}
}

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 - present theajack <contact@theajack.com>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

10
npm/poly/index.d.ts vendored
View File

@ -1,10 +0,0 @@
declare const poly: Function;
declare module 'cnchar' {
interface CnCharStatic {
setPolyPhrase(word: string, spell: string): void;
setPolyPhrase(json: {[key: string]: string}): void;
}
}
export default poly;

View File

@ -1,146 +0,0 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
var polyPhrases = require('./polyphone-phrase-simple.json');
var _cnchar = null;
var _ = {}; // 工具方法
// let arg = {origin:'origin'}
var arg = {
poly: 'poly'
};
var _spell;
function _poly() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var str = args[0]; // 待处理的字符串
args = args.splice(1);
_.checkArgs('spell', args, true);
if (_.has(args, _.arg.poly)) return _spell.apply(void 0, [str].concat(_toConsumableArray(args)));
var newArgs = [_.arg.array]; // 先用数组
var tone = _.has(args, _.arg.tone); // // 多音字参数参数将被忽略
// if(_.has(args,_.arg.poly))
// _._warn('多音字参数 poly 被忽略')
if (tone) {
newArgs.push(_.arg.tone);
} // 音调参数
// 其他几个参数等获取到多音拼音之后在处理
var res = _spell.apply(void 0, [str].concat(newArgs)); // 获取
for (var k in polyPhrases) {
var index = str.indexOf(k);
if (index !== -1) {
// 命中了多音词词库
var pa = polyPhrases[k].split(' '); // 多音词拼音数组
for (var i = 0; i < pa.length; i++) {
res[index + i] = _.removeTone(pa[i], tone).spell;
}
}
}
_.dealUpLowFirst(res, args);
if (!_.has(args, _.arg.array)) {
res = res.join('');
}
return res;
}
function setPolyPhrase(word, spell) {
if (_typeof(word) === 'object') {
for (var k in word) {
setPolyPhrase(k, word[k]);
}
return;
}
polyPhrases[word] = spell.split(' ').map(function (s) {
return _cnchar.shapeSpell(s);
}).join(' ');
}
function main(cnchar) {
if (cnchar.plugins.indexOf('poly') !== -1) {
return;
}
cnchar.setPolyPhrase = setPolyPhrase;
cnchar.plugins.push('poly');
_spell = cnchar._origin.spell;
_ = cnchar._;
_cnchar = cnchar;
var _new = function _new() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
if (_.has(args, arg.poly)) {
// 有 poly参数则不使用多音词模式
return _spell.apply(void 0, args);
}
return _poly.apply(void 0, args);
};
cnchar.spell = _new;
String.prototype.spell = function () {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return _new.apply(void 0, [this].concat(args));
}; // cnchar.type.spell.origin = arg.origin;
cnchar._.poly = true;
if (cnchar._reinitSpellPoly) {
cnchar._reinitSpellPoly();
delete cnchar._reinitSpellPoly;
}
}
function init(cnchar) {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && window.CnChar) {
main(window.CnChar);
} else if (typeof cnchar !== 'undefined') {
main(cnchar);
}
}
init();
module.exports = init;

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 - present theajack <contact@theajack.com>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,17 +0,0 @@
declare type radicalArg = 'array';
export declare interface Radical {
(text:string | Array<string>, ...radicalArgs: Array<radicalArg>): string | Array<string>;
setRadical(word: string, radical: string): void;
setRadical(json: {[key: string]: string}): void;
}
declare const radical: Radical;
declare module 'cnchar' {
interface CnCharStatic {
radical: Radical;
}
}
export default radical;

View File

@ -1,38 +0,0 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _require = require('./radical'),
radical = _require.radical,
arg = _require.arg,
setCnchar = _require.setCnchar,
setRadical = _require.setRadical;
function main(cnchar) {
if (cnchar.plugins.indexOf('radical') !== -1) {
return;
}
cnchar.plugins.push('radical');
cnchar.radical = radical;
cnchar.type.radical = arg;
}
function init(cnchar) {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.CncharRadical) {
window.CncharRadical = radical;
}
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && window.CnChar) {
main(window.CnChar);
setCnchar(window.CnChar);
} else if (typeof cnchar !== 'undefined') {
main(cnchar);
setCnchar(cnchar);
}
}
radical.init = init;
radical.setRadical = setRadical;
init();
module.exports = radical;

View File

@ -1,61 +0,0 @@
"use strict";
var radicals = require('./radicals.json');
var arg = {
array: 'array'
};
var _cnchar = null;
function radical() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 0) {
console.warn('idiom: 请输入搜索项');
return;
}
var input = args[0];
args = args.slice(1);
if (_cnchar) {
_cnchar._.checkArgs('radical', args);
}
var res = '';
for (var i = 0; i < input.length; i++) {
var _char = radicals[input[i]];
if (_char) {
res += _char;
} else {
res += input[i];
}
}
if (args.indexOf(arg.array) !== -1 || input instanceof Array) {
return res.split('');
}
return res;
}
function setCnchar(cnchar) {
_cnchar = cnchar; // initToneCodes(cnchar);
}
function setRadical(key, value) {
_cnchar._.mapJson(key, value, function (k, v) {
radicals[k] = v;
});
}
module.exports = {
radical: radical,
arg: arg,
setCnchar: setCnchar,
setRadical: setRadical
};

View File

@ -1,195 +0,0 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _wrapRegExp(re, groups) { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _RegExp = _wrapNativeSuper(RegExp); var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = _RegExp.call(this, re, flags); _groups.set(_this, groups || _groups.get(re)); return _this; } _inherits(BabelRegExp, _RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = []; args.push.apply(args, arguments); if (_typeof(args[args.length - 1]) !== "object") { args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function buildData() {
var _require = require('fs'),
createReadStream = _require.createReadStream,
fsPromises = _require.promises;
var _require2 = require('path'),
join = _require2.join;
var _require3 = require('readline'),
createInterface = _require3.createInterface;
var wordRegex = /*#__PURE__*/_wrapRegExp(/"word": "(.*)"/, {
word: 1
});
var radicalsRegex = /*#__PURE__*/_wrapRegExp(/"radicals": "(.*)"/, {
radicals: 1
}); // https://raw.githubusercontent.com/pwxcoo/chinese-xinhua/master/data/word.json
var inputPath = join(__dirname, 'word.json');
var outputPath = join(__dirname, 'radicals.json');
return new Promise(function (resolve, reject) {
var words = new Map();
var word = null;
var radicals = null;
var readStream = createReadStream(inputPath, {
encoding: 'utf8',
autoClose: true,
emitClose: true
});
var readLine = createInterface({
input: readStream
});
readStream.on('error', function (err) {
return reject(err);
});
readLine.on('close', function () {
return resolve(words);
});
readLine.on('line', function (line) {
var matches = wordRegex.exec(line);
if (matches && matches.groups) {
word = matches.groups.word;
radicals = null;
} else {
matches = radicalsRegex.exec(line);
if (matches && matches.groups) {
radicals = matches.groups.radicals;
if (word && word.length > 0 && radicals && radicals.length > 0) {
words.set(word, radicals);
}
word = null;
radicals = null;
}
}
});
}).then( /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(words) {
var output, first, _iterator, _step, _step$value, word, radicals;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return fsPromises.open(outputPath, 'w');
case 2:
output = _context.sent;
_context.next = 5;
return output.write('{\n');
case 5:
first = true;
_iterator = _createForOfIteratorHelper(words);
_context.prev = 7;
_iterator.s();
case 9:
if ((_step = _iterator.n()).done) {
_context.next = 21;
break;
}
_step$value = _slicedToArray(_step.value, 2), word = _step$value[0], radicals = _step$value[1];
if (!first) {
_context.next = 17;
break;
}
first = false;
_context.next = 15;
return output.write(" \"".concat(word, "\": \"").concat(radicals, "\""));
case 15:
_context.next = 19;
break;
case 17:
_context.next = 19;
return output.write(",\n \"".concat(word, "\": \"").concat(radicals, "\""));
case 19:
_context.next = 9;
break;
case 21:
_context.next = 26;
break;
case 23:
_context.prev = 23;
_context.t0 = _context["catch"](7);
_iterator.e(_context.t0);
case 26:
_context.prev = 26;
_iterator.f();
return _context.finish(26);
case 29:
_context.next = 31;
return output.write('\n}\n');
case 31:
case "end":
return _context.stop();
}
}
}, _callee, null, [[7, 23, 26, 29]]);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}());
}
buildData().then(function () {
return console.log('完成');
}, function (err) {
return console.error(err);
});

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 - present theajack <contact@theajack.com>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,85 +0,0 @@
"use strict";
var tradDict = require('./trad-simple.json');
var sparkDict = require('./spark-simple.json');
var type = {
trad: 'trad',
simple: 'simple',
spark: 'spark'
};
function convert(str, to, from) {
if (typeof to === 'undefined' || !type[to]) {
throw new Error('convert 参数类型错误: to=' + to);
}
if (typeof from === 'undefined' || !type[from]) {
throw new Error('convert 参数类型错误: from=' + from);
}
var toDict = '',
fromDict = '';
if (to === type.simple) {
if (from === type.trad) {
// 繁体 => 简体
toDict = tradDict.simple;
fromDict = tradDict.trad;
} else {
// 火星 => 简体
toDict = sparkDict.simple;
fromDict = sparkDict.spark;
}
} else if (to === type.trad) {
if (from === type.simple) {
// 简体 => 繁体
toDict = tradDict.trad;
fromDict = tradDict.simple;
} else {
// 火星 => 繁体
return convert(convert(str, type.simple, type.spark), type.trad, type.simple);
}
} else {
if (from === type.trad) {
// 繁体 => 火星
return convert(convert(str, type.simple, type.trad), type.spark, type.simple);
} else {
// 简体 => 火星
toDict = sparkDict.spark;
fromDict = sparkDict.simple;
}
}
var res = '';
for (var i = 0; i < str.length; i++) {
var index = fromDict.indexOf(str[i]);
res += index !== -1 ? toDict[index] : str[i];
}
return res;
}
module.exports = {
type: type,
simpleToTrad: function simpleToTrad(str) {
return convert(str, type.trad, type.simple);
},
simpleToSpark: function simpleToSpark(str) {
return convert(str, type.spark, type.simple);
},
tradToSimple: function tradToSimple(str) {
return convert(str, type.simple, type.trad);
},
tradToSpark: function tradToSpark(str) {
return convert(str, type.spark, type.trad);
},
sparkToSimple: function sparkToSimple(str) {
return convert(str, type.simple, type.spark);
},
sparkToTrad: function sparkToTrad(str) {
return convert(str, type.trad, type.spark);
}
};

View File

@ -1,8 +0,0 @@
interface String {
convertSimpleToTrad(): string;
convertSimpleToSpark(): string;
convertTradToSimple(): string;
convertTradToSpark(): string;
convertSparkToSimple(): string;
convertSparkToTrad(): string;
}

18
npm/trad/index.d.ts vendored
View File

@ -1,18 +0,0 @@
import './extend';
declare const trad: Function;
declare module 'cnchar' {
interface CnCharStatic {
convert: {
simpleToSpark(sentence: string): string;
simpleToTrad(sentence: string): string;
sparkToSimple(sentence: string): string;
sparkToTrad(sentence: string): string;
tradToSimple(sentence: string): string;
tradToSpark(sentence: string): string;
};
}
}
export default trad;

View File

@ -1,298 +0,0 @@
"use strict";
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var countDict = require('./stroke-count-fan.json');
var orderDict = require('./stroke-order-fan.json'); // 简-烦 一对多
// https://blog.csdn.net/e15273/article/details/79954700
var convert = require('./converter');
var arg = {
trad: 'trad',
simple: 'simple',
array: 'array',
order: 'order' // 开启简单模式
};
var _ = {}; // 工具方法
function main(cnchar) {
if (cnchar.plugins.indexOf('trad') !== -1) {
return;
}
cnchar.plugins.push('trad');
cnchar.convert = convert;
var _p = String.prototype;
cnchar.type.spell.simple = arg.simple;
cnchar.type.stroke.simple = arg.simple;
cnchar.type.spell.trad = arg.trad;
cnchar.type.stroke.trad = arg.trad;
reinitSpell(_p, cnchar);
reinitStroke(_p, cnchar); // _p.convert = function(to,from){return convert(this,to,from);}
_p.convertSimpleToTrad = function () {
return convert.simpleToTrad(this);
};
_p.convertSimpleToSpark = function () {
return convert.simpleToSpark(this);
};
_p.convertTradToSimple = function () {
return convert.tradToSimple(this);
};
_p.convertTradToSpark = function () {
return convert.tradToSpark(this);
};
_p.convertSparkToSimple = function () {
return convert.sparkToSimple(this);
};
_p.convertSparkToTrad = function () {
return convert.sparkToTrad(this);
}; // _p.convertToTrad = function(){return convert.toTrad(this);}
// _p.convertToSimple = function(){return convert.toSimple(this);}
// _p.convertToSpark = function(){return convert.toSpark(this);}
_ = cnchar._;
_.convert = convert;
_.dict.getTradOrders = function () {
return orderDict;
};
_.dict.getTradCount = function () {
return countDict;
};
}
function init(cnchar) {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && window.CnChar) {
main(window.CnChar);
} else if (typeof cnchar !== 'undefined') {
main(cnchar);
}
}
function reinitSpell(proto, cnchar) {
var _spell = cnchar.spell;
var newSpell = function newSpell() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var str = args[0];
args = args.splice(1);
if (_.has(args, arg.simple)) {
return _spell.apply(void 0, [str].concat(_toConsumableArray(args)));
}
if (_.has(args, arg.trad)) {
var isArr = _.has(args, arg.array);
if (!isArr) {
args.push(arg.array);
} // 先使用array模式
var simpleStr = convert.tradToSimple(str);
var simples = [];
var newStr = ''; // 提取出繁体字的简体
for (var i = 0; i < simpleStr.length; i++) {
if (simpleStr[i] !== str[i]) {
newStr += simpleStr[i];
} else {
simples.push({
index: i,
str: str[i]
});
}
}
var res = _spell.apply(void 0, [newStr].concat(_toConsumableArray(args)));
for (var _i = 0; _i < simples.length; _i++) {
res.splice(simples[_i].index, 0, simples[_i].str);
}
return isArr ? res : res.join('');
}
str = convert.tradToSimple(str);
return _spell.apply(void 0, [str].concat(_toConsumableArray(args)));
};
proto.spell = function () {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return newSpell.apply(void 0, [this].concat(args));
};
cnchar.spell = function () {
return newSpell.apply(void 0, arguments);
};
if (!cnchar._.poly) {
cnchar._reinitSpellPoly = function () {
_spell = cnchar.spell;
proto.spell = function () {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return newSpell.apply(void 0, [this].concat(args));
};
cnchar.spell = function () {
return newSpell.apply(void 0, arguments);
};
};
;
}
}
function reinitStroke(proto, cnchar) {
var _stroke = cnchar.stroke;
var _new = function _new() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
var str = args[0];
args = args.splice(1);
_.checkArgs('stroke', args, true);
var isArr = _.has(args, arg.array);
var isOrder = _.has(args, arg.order);
if (!isArr) {
args.push(arg.array);
} // 先使用array模式
var res = _stroke.apply(void 0, [str].concat(_toConsumableArray(args))); // 没有繁体的结果
if (!isOrder) {
// stroke 方法
if (_.has(args, arg.simple)) {
// 启用简单模式则 直接返回
return isArr ? res : _.sumStroke(res);
}
if (_.has(args, arg.trad)) {
for (var j = 0; j < res.length; j++) {
if (res[j] !== 0) {
res[j] = -1;
}
}
}
for (var _i2 in countDict) {
_i2 = parseInt(_i2);
for (var j = 0; j < res.length; j++) {
if (res[j] === 0 && countDict[_i2].indexOf(str[j]) !== -1) {
res[j] = _i2;
}
}
}
if (_.has(args, arg.trad)) {
for (var j = 0; j < res.length; j++) {
if (res[j] === -1) {
res[j] = 0;
}
}
}
return isArr ? res : _.sumStroke(res);
} else {
// strokeOrder 方法
if (_.has(args, arg.simple)) {
// 启用简单模式则 直接返回
return res;
}
if (_.has(args, arg.trad)) {} // 只使用繁体字
// 将其中的繁体字获取 strokeOrder
var igList = [];
for (var i = 0; i < res.length; i++) {
if (typeof res[i] === 'undefined') {
res[i] = orderDict[str[i]]; // 字母版笔画表
} else {
igList.push(i);
}
}
return _.orderWithLetters(res, str, args, igList);
}
};
proto.stroke = function () {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
return _new.apply(void 0, [this].concat(args));
};
cnchar.stroke = function () {
return _new.apply(void 0, arguments);
};
if (!cnchar._.order) {
cnchar._reinitStrokeOrder = function () {
_stroke = cnchar.stroke;
proto.stroke = function () {
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
args[_key6] = arguments[_key6];
}
return _new.apply(void 0, [this].concat(args));
};
cnchar.stroke = function () {
return _new.apply(void 0, arguments);
};
};
;
}
}
init();
module.exports = init;

File diff suppressed because one or more lines are too long

View File

@ -1,35 +0,0 @@
{
"0": "",
"1": "",
"2": "",
"3": "三",
"4": "戶內勻",
"5": "冊",
"6": "丟扡汙",
"7": "貝別車沈沖囪兌夾見決呂沒刪禿吳災妝壯",
"8": "並長東兒岡矽糾屆況來兩侖門妳臥協亞軋爭狀",
"9": "訂飛風負訃軌紅後級計紀勁荊軍侶卻紉陝屍帥韋俠洶彥頁約則柵貞陣茲",
"10": "剝狽畢財倉陳恥純島釘凍鬥紡紛剛個宮貢剮華記莢莖徑晉庫倆連陸倫馬脈們畝納紐豈氣訖殺紗閃師時書孫討條紋烏務峽狹挾脅軒訓訊陰郵娛員悅這針紙莊",
"11": "敗絆閉貶缽參側産處從帶釣頂動隊訛釩販訪婦崗夠貫規國過貨堅將階淨進訣萊淚涼淩婁鹵掄淪麥覓鳥貧淒啓牽釺淺強氫頃區軟掃紹設紳視術訟貪屜烴脫偉問渦習細現鄉許敘啞訝陽異魚責紮斬張帳偵掙猙執終晝專著組",
"12": "綁報備筆補殘廁測場鈔創詞湊達貸單盜棟鈍惡貳發琺飯費馮鈣稈臯給鈎貴賀壺畫換喚渙黃揮葷渾禍極幾間堿揀減絞痙廄傑結絕鈞開凱殼塊勞祿絡買貿悶鈉惱甯鈕評棲棄喬欽韌絨閏傘喪腎勝稅順絲訴筍湯貼統萬違圍爲葦無閑廂項虛須絢尋硯揚堯爺葉壹飲喲詠湧猶遊馭淵雲鄖隕運棗詐棧脹診幀衆軸貯鄒詛",
"13": "愛奧頒飽鉑蒼滄詫腸誠馳傳誕當搗滌遞電叠頓煩楓該蓋幹溝詭號嘩話煥毀賄會彙際賈鉀腳較節經絹僅誇裏蓮漣煉賃鈴虜賂亂媽嗎鉚夢滅腦農鉛鉗嗆搶傾傷聖獅詩勢飾試飼頌肅綏歲損塗蛻馱頑溫窩嗚塢廈羨詳詢馴遜煙楊搖遙業義詣蔭傭鈾與預園圓遠粵暈載賊閘債盞睜腫誅裝資",
"14": "幣賓餅駁蔔慚慘摻嘗暢塵稱綢綽蔥鄲鄧墊對奪墮爾餌罰閥瘋鳳輔複趕綱閣鉻構慣廣閨滾漢閡滬劃瘓誨夥監箋漸蔣鉸僥餃稭誡緊盡摳寬厲鄰領摟鋁屢綠綸瑪滿麽綿閩鳴銘瘧嘔漚頗齊塹槍僑寢輕認榮賒滲蝕實適壽說碩誦隨瑣態銅圖團窪網維僞聞撾蝸誣誤銑銜緒厭瘍養瑤銥銀熒誘漁語獄劄嶄綻漲趙鄭滯種墜綴漬綜",
"15": "皚罷輩鋇編標撥層廠徹撐遲齒廚鋤瘡賜撣憚彈蕩導敵締調賭緞餓範誹廢墳憤鋒膚撫賦鞏劊輥緩輝緝價駕緘儉踐賤劍澗漿槳獎膠澆嬌駒劇潔課褲儈潰撈澇樂憐練輛諒遼凜劉樓魯慮輪論碼罵賣邁貓冪緬廟憫撓鬧餒撚諾歐毆盤賠噴潑撲鋪遷潛請慶窮確熱銳潤賞審駛樞豎數誰慫撻談歎銻駝橢緯衛蕪蝦賢險線銷寫鋅噓選鴉樣窯遺儀億誼瑩憂緣閱暫賬摯幟質皺豬諸駐樁諄",
"16": "辦鮑憊艙熾醜錘錯擔擋燈澱諜錠獨噸奮縫諷輻縛鋼館龜鍋駭橫還謊諱獲機積輯薊劑頰撿薦鍵餞頸靜舉據鋸錦墾窺賴勵曆龍盧擄錄駱螞瞞錨錳謎謀膩濃頻憑樸錢薔橋親薩篩燒輸樹壇燙縧頭頹鴕謂錫鍁縣餡憲蕭曉嘯諧興學勳鴨閹閻諺鴦頤彜憶隱螢營穎擁踴嶼鴛擇澤戰鍺築磚錐濁",
"17": "襖幫謗繃斃濱擯燦償騁儲聰膽檔點鍍鍛糞擱鴿購韓鴻環燴擊績擠濟艱檢講矯舊駿顆懇虧擴闊藍闌濫禮隸聯斂臉療臨嶺簍縷鎂彌擬獰擰濘膿謙牆鍬趨賽澀聲濕聳雖縮擡濤謄濰甕戲轄嚇鮮謝壓謠嬰應優輿禦轅嶽醞鍘齋氈輾蟄擲鍾謅燭賺贅總縱",
"18": "翺擺鎊邊蟬蟲雛礎闖叢竄禱斷鵝額豐鎬歸櫃穢雞繭簡檻濺醬鵑謹燼曠壘離鯉鏈糧獵餾隴濾謾謬攆聶鎳檸臍騎翹竅瓊軀擾繞繕嬸繩雙擻鎖題鎢霧瀉顔藥醫藝蠅雜鎮織職轉蹤",
"19": "藹礙癟瀕鏟懲癡寵疇櫥辭顛犢關懷壞繪譏繳轎鯨鏡礦臘懶類麗瀝簾嚨壟攏蘆廬羅饅難龐鵬騙蘋譜簽勸鵲騷識獸爍蘇獺譚襪穩蠍繡嚴癢蟻繹願蘊韻贊贈轍證",
"20": "寶辮攙闡襯籌觸黨礬護饑繼艦競覺饋攔籃蘭瀾礫鐐齡爐飄譴饒鰓贍釋騰犧鹹獻響懸議譯贏譽竈",
"21": "辯纏躊顧鶴轟歡殲懼巋蠟欄覽爛鐳鐮騾齧驅權攝懾屬鐵囂攜鏽續櫻躍贓髒",
"22": "顫疊讀龔鑒驕驚聾籠巒孿蘿邏鷗竊灑贖攤灘體聽彎襲癬攢鑄",
"23": "變鼈蠱攪戀鱗攣黴曬纖顯驗纓癰",
"24": "壩蠶讒贛觀鹼讕攬籬靈釀齲讓癱鹽鷹驟囑",
"25": "饞躥顱籮蠻廳灣鑲鑰",
"26": "驢灤鑷顴釁矚",
"27": "纜鑼鑽",
"28": "豔鑿",
"29": "",
"30": "",
"31": "",
"32": "籲"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2017 - present theajack <contact@theajack.com>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

17
npm/xhy/index.d.ts vendored
View File

@ -1,17 +0,0 @@
declare type xhyArg = 'fuzzy' | 'answer' | 'second';
export declare interface XHY {
(text:string, ...xhyArgs: Array<xhyArg>): Array<string>;
addXhy(args: Array<Array<string> | string>): void;
addXhy(xhyHead: string, xhyTail: string): void;
}
declare const xhy: XHY;
declare module 'cnchar' {
interface CnCharStatic {
xhy: XHY;
}
}
export default xhy;

View File

@ -1,37 +0,0 @@
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _require = require('./xhy'),
xhy = _require.xhy,
arg = _require.arg,
addXhy = _require.addXhy,
setCnchar = _require.setCnchar;
function main(cnchar) {
if (cnchar.plugins.indexOf('xhy') !== -1) {
return;
}
setCnchar(cnchar);
cnchar.plugins.push('xhy');
cnchar.xhy = xhy;
cnchar.type.xhy = arg;
}
function init(cnchar) {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.CncharXHY) {
window.CncharXHY = xhy;
}
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && window.CnChar) {
main(window.CnChar);
} else if (typeof cnchar !== 'undefined') {
main(cnchar);
}
}
xhy.init = init;
xhy.addXhy = addXhy;
init();
module.exports = xhy;

View File

@ -1,103 +0,0 @@
"use strict";
var dict = require('./xhy.json').dict;
var _cnchar = null;
var arg = {
'fuzzy': 'fuzzy',
'answer': 'answer',
'second': 'second'
};
function xhy() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var str = args.shift();
if (_cnchar) {
_cnchar._.checkArgs('xhy', args);
}
var isFuzzy = args.indexOf(arg.fuzzy) !== -1;
var onlyAnswer = args.indexOf(arg.answer) !== -1;
var second = args.indexOf(arg.second) !== -1;
var quesIndex = second ? 1 : 0;
var answerIndex = 1 - quesIndex;
if (isFuzzy) {
var res = [];
for (var i = 0; i < dict.length; i++) {
if (dict[i][quesIndex].indexOf(str) !== -1) {
var answer = shapeAnswer(dict[i], onlyAnswer, answerIndex);
res = res.concat(answer);
}
}
return res;
} else {
for (var _i = 0; _i < dict.length; _i++) {
if (dict[_i][quesIndex] === str) {
return shapeAnswer(dict[_i], onlyAnswer, answerIndex);
}
}
}
return [];
}
function shapeAnswer(item, onlyAnswer, answerIndex) {
var answer = null;
if (item[answerIndex].indexOf('') !== -1) {
answer = item[answerIndex].split('');
} else {
answer = [item[answerIndex]];
}
if (!onlyAnswer) {
var fn = answerIndex === 1 ? function (a, index) {
answer[index] = "".concat(item[1 - answerIndex], "-").concat(a);
} : function (a, index) {
answer[index] = "".concat(a, "-").concat(item[1 - answerIndex]);
};
answer.forEach(fn);
}
return answer;
}
function addXhy(arg, arg2) {
if (typeof arg === 'string' && typeof arg2 === 'string') {
addXhy([arg, arg2]);
return;
}
if (!(arg instanceof Array)) {
_cnchar._._warn('addXhy 参数必须为数组');
return;
}
if (arg[0] instanceof Array) {
arg.forEach(function (item) {
xhy.addXhy(item);
});
return;
}
dict.push(arg);
}
function setCnchar(cnchar) {
_cnchar = cnchar;
}
module.exports = {
xhy: xhy,
arg: arg,
addXhy: addXhy,
setCnchar: setCnchar
};

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More