dsh-plugin-term-dictionary 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ # Patch layer of the `dsh-plugin-term-dictionary` bundle.
2
+ #
3
+ # One row only: the package's own host half. The browser half is not a row —
4
+ # `dsh.client` in package.json declares it, so the Client module system picks
5
+ # the bundle up and loads `exports["./client"]` on the page.
6
+ #
7
+ # The host half owns the dictionary file and the HTTP surface the page reads.
8
+ # `webServer` is optional in `inject`: in a deployment without the Web carrier
9
+ # the host half stays dormant and the browser half keeps working from local
10
+ # storage.
11
+
12
+ - insert:
13
+ - id: term-dictionary
14
+ name: 'dsh-plugin-term-dictionary'
package/icon.svg ADDED
@@ -0,0 +1,13 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" role="img" aria-label="术语词典">
2
+ <title>术语词典</title>
3
+ <circle cx="12" cy="12" r="9.25" fill="#4D6BFE"/>
4
+ <g fill="none" stroke="#FFFFFF" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round">
5
+ <path d="M12 7.1c-1.2-.9-2.7-1.3-4.6-1.3-.5 0-.8.3-.8.8v7.9c0 .5.3.8.8.8 1.9 0 3.4.4 4.6 1.3"/>
6
+ <path d="M12 7.1c1.2-.9 2.7-1.3 4.6-1.3.5 0 .8.3.8.8v7.9c0 .5-.3.8-.8.8-1.9 0-3.4.4-4.6 1.3"/>
7
+ <path d="M12 7.1v9.5"/>
8
+ </g>
9
+ <g fill="none" stroke="#FFFFFF" stroke-width="1.7" stroke-linecap="round">
10
+ <circle cx="15.6" cy="15.4" r="2.5" fill="#4D6BFE"/>
11
+ <path d="M17.5 17.3l2.1 2.1"/>
12
+ </g>
13
+ </svg>
@@ -0,0 +1,52 @@
1
+ # 术语词典内置词库说明(lexicon / stopwords)
2
+
3
+ ## 这些文件是做什么的
4
+
5
+ `lib/lexicon.en.js`、`lib/lexicon.zh.js`、`lib/stopwords.js` 是插件离线识别术语的**纯数据层**:
6
+ 不联网、不做任何逻辑,由浏览器打包表与 Node 测试共同加载。检测器命中词库即直接给出中文释义,
7
+ 未命中才走模型兜底;词库同时用于过滤,避免把日常词误判成专业术语。
8
+
9
+ ## 数据格式(三个文件都必须遵守)
10
+
11
+ ```js
12
+ module.exports = {
13
+ "<键>": { zh: "中文译名", domain: "领域标签", gloss: "一句中文解释" },
14
+ };
15
+ ```
16
+
17
+ - `zh`:中文译名。英文词库要求 2–8 个汉字、不含英文数字;中文词库要求 3–8 个汉字的口语化改写。
18
+ - `domain`:只能取 `计算机`、`软件工程`、`人工智能`、`数据`、`网络`、`安全`、`运维`、`数学`、`系统`、`产品`。
19
+ - `gloss`:一句话讲清“它是什么”,面向不懂该术语的聪明读者;不解释词源,实测长度 15–31 汉字。
20
+ - 英文键一律小写 ASCII,只允许单个空格、连字符、点;中文键为 2–6 个汉字。
21
+ - 三个文件都必须是 CommonJS(`"use strict";` + `module.exports`),**不得出现** `import`/`export`/`require`,
22
+ 也不得有任何副作用代码——浏览器打包表需要可直接取用的 `module.exports` 值。
23
+
24
+ ## 如何新增词条
25
+
26
+ 1. 在对应文件的对象里加一行,键按上文规则写,`zh`/`domain`/`gloss` 三个字段缺一不可。
27
+ 2. 放入文件时保持“一行一条”,便于 diff;大小写、错别字、重复键都会让检测静默失效,务必自查。
28
+ 3. 日常词、代词、介词、动词不要进 lexicon,应进 `stopwords.js` 的 `EN`/`ZH` 数组。
29
+ 4. 两个数组必须**去重并排序**(`EN` 按字典序,`ZH` 按码点序),新增后重新排序。
30
+ 5. 改完必须跑一遍校验:条目数、三字段非空、重复键、数组重复、键大小写。
31
+
32
+ > 注意:`lib/package.json` 里的 `{"type":"commonjs"}` 是作用域标记,缺了它 Node 会按外层
33
+ > `package.json` 的 `"type": "module"` 把这些 `.js` 当 ESM,`require` 将取不到词条。
34
+
35
+ ## 当前实际条目数(校验命令实测)
36
+
37
+ | 文件 | 内容 | 条目数 | 备注 |
38
+ | --- | --- | --- | --- |
39
+ | `lexicon.en.js` | 英文技术术语 | **864** | 领域分布:人工智能 210、软件工程 193、数据 92、数学 76、安全 74、计算机 67、系统 64、运维 61、网络 20、产品 7 |
40
+ | `lexicon.zh.js` | 中文行业黑话 | **241** | 领域分布:人工智能 63、系统 43、运维 41、数据 40、产品 30、软件工程 17、网络 3、安全 2、计算机 2 |
41
+ | `stopwords.js` | 英文停用词 `EN` | **893** | 已排序去重;含常见虚词、动词、名词与 `data`/`code`/`user` 等日常技术词 |
42
+ | `stopwords.js` | 中文停用词 `ZH` | **220** | 已排序去重;含常用单字与“我们/可以/通过/因为”等高频二字词 |
43
+
44
+ ## 明显偏薄、下一步应扩的区域
45
+
46
+ - **英文**:网络(20)与产品(7)远低于其他板块,需要补 HTTP/TCP 细节、云网络、增长与商业化术语。
47
+ - **英文缺口领域**:编译原理与链接细节、数据库存储引擎内部、计算机体系结构与指令集、图形学与音视频编解码、
48
+ 量化金融、生物信息、硬件与嵌入式。这些目前基本没覆盖。
49
+ - **中文**:网络(3)、安全(2)、计算机(2)几乎没有;另缺医疗、金融、法律、汽车制造、游戏、政务等行业黑话。
50
+ - **中文缺口形态**:多为运维/架构/产品口径的互联网黑话,缺少传统行业术语与地方性缩写。
51
+ - **停用词**:`EN` 尚未覆盖专有名词、人名地名与缩写黑名单;`ZH` 还缺大量常见二字词、姓氏与机构名,
52
+ 后续应按真实语料高频词补齐,而不是凭印象堆量。