transproof-dsh-plugin 0.1.13 → 0.1.14

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.
package/app/index.html CHANGED
@@ -792,6 +792,7 @@ header::before{content:"";position:absolute;top:0;left:0;right:0;height:4px;z-in
792
792
  <label style="display:flex;gap:6px;align-items:center;cursor:pointer"><input type="checkbox" id="ao-quality" checked style="width:auto"> 译文总评分(含漏译残留 / 占位符保护)</label>
793
793
  <label style="display:flex;gap:6px;align-items:center;cursor:pointer"><input type="checkbox" id="ao-tone" style="width:auto"> 风格简报</label>
794
794
  <label style="display:flex;gap:6px;align-items:center;cursor:pointer"><input type="checkbox" id="ao-style" checked style="width:auto"> 翻译腔</label>
795
+ <label style="display:flex;gap:6px;align-items:center;cursor:pointer"><input type="checkbox" id="ao-screen" checked style="width:auto"> 规则预筛(连续标点 / 数字单位粘连)</label>
795
796
  </div>
796
797
  <div class="tb-g">
797
798
  <button class="btn gray sm" id="btn-audit" title="本地扫描:检查术语是否前后统一、术语库译法是否被遵守(不调 AI、不花 token)">🩺 术语体检</button>
@@ -1724,6 +1725,7 @@ Entfremdung | 异化 | 马克思;与 Verfremdung「间离」区分"></textarea
1724
1725
  <tr><td><b>⚖️ 双模型分工(v4.51 新)</b></td><td>设置页可指定「初稿模型」与「审校模型」:便宜模型翻初稿,强模型做批评/精修/校对,省 token(留空 = 不分工,行为不变)</td></tr>
1725
1726
  <tr><td><b>🎲 抽样质检(v4.51 新)</b></td><td>长文不全文复查:按 10% 抽样(5~30 句、少于 50 句全查),一次调用核查漏译/误译/术语不一致,给出错误率 + 交付建议(手动触发,不自动烧 token)</td></tr>
1726
1727
  <tr><td><b>📝 豁免登记(v4.52 新)</b></td><td>术语/专名/批注三处可登记「有意不一致」+ 理由,体检不再报;疑问清单与交付报告里可看到豁免清单</td></tr>
1728
+ <tr><td><b>🧹 规则预筛(v4.53 新)</b></td><td>体检中心新增本地正则预筛:连续感叹/问号、数字与单位粘连(如 3kg→3 kg),零 token</td></tr>
1727
1729
  </tbody>
1728
1730
  </table>
1729
1731
  <div class="alert i" style="margin-top:12px">
@@ -1879,6 +1881,7 @@ Entfremdung | 异化 | 马克思;与 Verfremdung「间离」区分"></textarea
1879
1881
  <tr><td><b>近期</b></td><td><b>双模型分工</b>:初稿/审校分开选模型,省着用</td><td>✅ 已上线(v4.51.0)</td></tr>
1880
1882
  <tr><td><b>近期</b></td><td><b>抽样质检</b>:长文抽样 10% 核查,给出错误率与交付建议</td><td>✅ 已上线(v4.51.0)</td></tr>
1881
1883
  <tr><td><b>近期</b></td><td><b>豁免登记</b>:有意不一致写理由,体检跳过,导出可见</td><td>✅ 已上线(v4.52.0)</td></tr>
1884
+ <tr><td><b>近期</b></td><td><b>规则预筛</b>:连续标点、数字单位粘连本地正则预筛</td><td>✅ 已上线(v4.53.0)</td></tr>
1882
1885
  <tr><td><b>云端版</b></td><td><b>改动留痕、可回溯</b>:每次重要校对留下不可篡改的备份点,谁改了什么、当时发生了什么都能查,不再靠猜</td><td>规划中</td></tr>
1883
1886
  </tbody>
1884
1887
  </table>
package/app/js/01-core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* ═══════════ 配置与状态 ═══════════ */
2
- const APP_VERSION = '4.52.0'; // 全局版本号:TransProof.version 与 #g-version 标签共用
2
+ const APP_VERSION = '4.53.0'; // 全局版本号:TransProof.version 与 #g-version 标签共用
3
3
  /* 左下角版本显示(v4.39.1) */
4
4
  (function(){
5
5
  function addVerTag(){
@@ -1159,7 +1159,7 @@ function showToneBrief(){
1159
1159
  /* ── 体检中心:开关 + 一键全检 ── */
1160
1160
  const AO_KEY = 'tp.auditOpts';
1161
1161
  function auditOptsGet(){
1162
- const d = { term:true, pnoun:true, para:true, num:true, quality:true, tone:false, style:true };
1162
+ const d = { term:true, pnoun:true, para:true, num:true, quality:true, tone:false, style:true, screen:true };
1163
1163
  const s = load(AO_KEY, null);
1164
1164
  return (s && typeof s === 'object') ? Object.assign(d, s) : d;
1165
1165
  }
@@ -1209,6 +1209,10 @@ function auditAll(){
1209
1209
  const r = styleAudit(target);
1210
1210
  add('翻译腔', r.issueCount || 0, r.clean ? '干净' : '句末落「的」/「的」堆叠/套话直译', 'showStyleAudit');
1211
1211
  }
1212
+ if(o.screen && typeof ruleScreen === 'function'){
1213
+ const r = ruleScreen(target);
1214
+ add('规则预筛', r.total || 0, r.total ? ('重复标点 / 数字单位粘连 ' + r.total + ' 处') : '干净', 'showRuleScreen');
1215
+ }
1212
1216
  if(o.quality && typeof qualityScore === 'function'){
1213
1217
  const q = qualityScore(src, target);
1214
1218
  add('译文总评分', q.items.length, '总分 ' + q.score + '(' + q.level + ')· ' + q.text, 'showQuality');
@@ -2080,3 +2084,35 @@ function syncOutView(){
2080
2084
  if(TRI_INLINE_ON) renderTriInline();
2081
2085
  }
2082
2086
  $$('#view-seg [data-view]').forEach(b => { b.onclick = () => setOutView(b.dataset.view); });
2087
+
2088
+
2089
+ /* ═══════════ 规则预筛(v4.53 本地正则零 token:重复标点扩展 + 数字单位粘连)═══════════ */
2090
+ function ruleScreen(text){
2091
+ const str = String(text || '');
2092
+ const items = [];
2093
+ const rp = (str.match(/[!?!?]{2,}/g) || []);
2094
+ if(rp.length){
2095
+ items.push({ rule:'重复标点', n: rp.length, detail:'连续感叹号/问号(!! / ??)', ex: rp.slice(0,3) });
2096
+ }
2097
+ const UNIT_RE = /(\d+)(kg|km|ml|cm|mm|gb|mb|kb|ghz|mhz|hz|kw|kj|kcal|mg|ms|ns)\b/gi;
2098
+ const nu = [];
2099
+ let m;
2100
+ while((m = UNIT_RE.exec(str)) !== null){
2101
+ nu.push(m[0]);
2102
+ if(nu.length >= 100) break;
2103
+ }
2104
+ if(nu.length){
2105
+ items.push({ rule:'数字单位粘连', n: nu.length, detail:'数字与单位连写(如 3kg 建议写 3 kg)', ex: nu.slice(0,3) });
2106
+ }
2107
+ return { items, total: items.reduce((a, x) => a + x.n, 0) };
2108
+ }
2109
+ function showRuleScreen(){
2110
+ const proof = (typeof extractProofText === 'function' ? extractProofText(LAST_OUT) : '') || (($('#dst') || {}).value || '').trim();
2111
+ if(!proof){ toast('先把译文贴进译文框,才能预筛', 'e'); return; }
2112
+ const r = ruleScreen(proof);
2113
+ const chip = 'display:inline-block;padding:3px 10px;border-radius:999px;background:var(--bg2);border:1px solid var(--bd);font-size:12px;color:var(--tx2)';
2114
+ const body = r.items.length
2115
+ ? r.items.map(it => '<div class="seg" style="margin-top:8px"><b>' + esc(it.rule) + '</b> <span style="' + chip + '">' + it.n + ' 处</span><div style="font-size:12.5px;color:var(--tx2);margin-top:4px">' + esc(it.detail) + '</div><div style="font-size:12.5px;color:var(--err);margin-top:2px">例:' + esc(it.ex.join('、')) + '</div></div>').join('')
2116
+ : '<div class="alert ok">✓ 规则预筛通过:没有连续感叹/问号、没有数字单位连写。</div>';
2117
+ modal('🧹 规则预筛(本地正则 · 零 token)', body + '<div class="hint" style="margin-top:10px">纯本地机械预筛,只抓「规则能确定」的格式硬伤,不判断语义。</div>');
2118
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "transproof-dsh-plugin",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "译校助手 TransProof 的 DeepSeek Harness 插件薄壳原型:把纯前端网页包进 DSH 页面入口 + 暴露「跑本地体检」Agent 工具。本地体检保持纯 JS 不联网。",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",