调整gbk大字符集往后;异形字改为可选

master
yutent 2022-03-22 09:46:10 +08:00
parent 27668f8fee
commit 2eebeefc22
3 changed files with 20 additions and 17 deletions

View File

@ -36537,7 +36537,6 @@
加大
加大力度
加到
加德满都
加点
加多
加尔各答

View File

@ -30,7 +30,7 @@
<div class="wrapper flex column">
<header class="table-info flex alc wrap">
现有单字GB2312(<b>{{gb2312}}</b>)个 + GBK(<b>{{gbk - gb2312}}</b>)个、异形字<b>{{dy}}</b>个、词组<b>{{words}}</b>个、网络热词<b>{{nethot}}</b>个、计算机术语<b>{{code}}</b>个、emoji<b>{{emoji}}</b>个!
现有单字GB2312(<b>{{gb2312}}</b>)个 + GBK(<b>{{gbk}}</b>)个、异形字<b>{{dy}}</b>个、词组<b>{{words}}</b>个、网络热词<b>{{nethot}}</b>个、计算机术语<b>{{code}}</b>个、emoji<b>{{emoji}}</b>个!
<wc-link class="download" type="primary" underline @click="openDownloadPanel">下载词库</wc-link>
</header>
@ -96,7 +96,7 @@
<wc-checkbox readonly value="2312">GB2312</wc-checkbox>
<wc-checkbox value="gbk">GBK</wc-checkbox>
<wc-checkbox readonly value="words">词组库</wc-checkbox>
<wc-checkbox readonly value="dy">异形字库</wc-checkbox>
<wc-checkbox value="dy">异形字库</wc-checkbox>
<wc-checkbox value="emoji">emoji</wc-checkbox>
<wc-checkbox value="nethot">网络热词</wc-checkbox>
<wc-checkbox value="code">计算机术语</wc-checkbox>

View File

@ -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)
}
// 异形字库
if (opt.tables.includes('dy')) {
temp.concat(WB_DY)
}
// 暂未支持
// if (opt.tables.includes('personal')) {