From 2eebeefc2294039f01800363f31a134c8bef399a Mon Sep 17 00:00:00 2001 From: yutent Date: Tue, 22 Mar 2022 09:46:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4gbk=E5=A4=A7=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E9=9B=86=E5=BE=80=E5=90=8E;=E5=BC=82=E5=BD=A2?= =?UTF-8?q?=E5=AD=97=E6=94=B9=E4=B8=BA=E5=8F=AF=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/words.txt | 1 - index.html | 4 ++-- js/index.js | 32 ++++++++++++++++++-------------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/data/words.txt b/data/words.txt index 61d9083..7f38632 100644 --- a/data/words.txt +++ b/data/words.txt @@ -36537,7 +36537,6 @@ 加大 加大力度 加到 -加德满都 加点 加多 加尔各答 diff --git a/index.html b/index.html index 16c6f62..e3a0163 100644 --- a/index.html +++ b/index.html @@ -30,7 +30,7 @@
- 现有单字GB2312({{gb2312}})个 + GBK({{gbk - gb2312}})个、异形字{{dy}}个、词组{{words}}个、网络热词{{nethot}}个、计算机术语{{code}}个、emoji{{emoji}}个! + 现有单字GB2312({{gb2312}})个 + GBK({{gbk}})个、异形字{{dy}}个、词组{{words}}个、网络热词{{nethot}}个、计算机术语{{code}}个、emoji{{emoji}}个! 下载词库
@@ -96,7 +96,7 @@ GB2312 GBK 词组库 - 异形字库 + 异形字库 emoji 网络热词 计算机术语 diff --git a/js/index.js b/js/index.js index abb63bb..66f66c9 100644 --- a/js/index.js +++ b/js/index.js @@ -23,6 +23,7 @@ const VER_86F = '86f' const WB_CODE_NAME = { 1: '一级简码', 2: '二级简码', 3: '三级简码', 4: '四级简码' } const WB_TABLE_2312 = new Enum() const WB_TABLE_GBK = new Enum() +const WB_TABLE_GBK_TEMP = new Enum() const WB_TABLE_86F = new Enum(FIXED_86F) const WB_WORDS = new Enum() const WB_DY = new Enum() @@ -50,7 +51,7 @@ Anot({ version: VER_86, reverse: true, pinyin: false, - tables: ['2312', 'words', 'dy'] + tables: ['2312', 'words'] }, total: 0, preview: '' @@ -85,7 +86,7 @@ Anot({ }) // 先使用gb2312, 目的是为了词库顺序以gb2312优先 - WB_TABLE_GBK.concat(WB_TABLE_2312) + WB_TABLE_GBK_TEMP.concat(WB_TABLE_2312) gbk.split('\n').forEach(it => { it = it.split(' ') @@ -94,9 +95,9 @@ Anot({ if (k) { WB_TABLE_GBK.add(k, it) + WB_TABLE_GBK_TEMP.add(k, it) } }) - window.WB_TABLE_GBK = WB_TABLE_GBK // words.split('\n').forEach(it => { @@ -105,7 +106,7 @@ Anot({ let k = it.shift() if (k) { - WB_WORDS.add(k, createCode(WB_TABLE_GBK, k)) + WB_WORDS.add(k, createCode(WB_TABLE_GBK_TEMP, k)) } }) @@ -135,7 +136,7 @@ Anot({ let k = it.shift() if (k) { - WB_NET.add(k, createCode(WB_TABLE_GBK, k)) + WB_NET.add(k, createCode(WB_TABLE_GBK_TEMP, k)) } }) code.split('\n').forEach(it => { @@ -144,7 +145,7 @@ Anot({ let k = it.shift() if (k) { - WB_CODE.add(k, createCode(WB_TABLE_GBK, k)) + WB_CODE.add(k, createCode(WB_TABLE_GBK_TEMP, k)) } }) @@ -156,10 +157,6 @@ Anot({ this.nethot = WB_NET.length this.code = WB_CODE.length - window.WB_WORDS = WB_WORDS - window.WB_NET = WB_NET - window.WB_CODE = WB_CODE - this.calculate() }) }, @@ -333,14 +330,14 @@ Anot({ var opt = { ...this.dlOpt } var temp = new Enum() + temp.concat(WB_TABLE_2312) + // 生成反查字库 if (opt.reverse) { if (opt.tables.includes('gbk')) { - temp.concat(WB_TABLE_GBK) - let bin = new Blob([WB_TABLE_GBK.toString()], { type: 'text/plain' }) + let bin = new Blob([WB_TABLE_GBK_TEMP.toString()], { type: 'text/plain' }) saveFile(bin, 'wb_table_gbk_reverse.txt') } else { - temp.concat(WB_TABLE_2312) let bin = new Blob([WB_TABLE_2312.toString()], { type: 'text/plain' }) saveFile(bin, 'wb_table_gb2312_reverse.txt') } @@ -364,8 +361,15 @@ Anot({ temp.concat(WB_CODE) } + // gbk 大字符集, 顺序往后调 + if (opt.tables.includes('gbk')) { + temp.concat(WB_TABLE_GBK) + } + // 异形字库 - temp.concat(WB_DY) + if (opt.tables.includes('dy')) { + temp.concat(WB_DY) + } // 暂未支持 // if (opt.tables.includes('personal')) {