Files
msime-windows/scripts/prepare-package-inputs.ps1
Lu Fan(SonnyCalcr) 5e03628a7e feat(installer): build cn-en translations into the local dictionary (#784)
* fix(server): drop part-of-speech labels from Ctrl+Enter translation senses

The machine-translated Chinese-to-English glosses prefix each sense with a
label ("n. silver medal", "proper n. Wanshan District"). The candidate
window keeps showing the whole gloss, but splitting it for Ctrl+Enter now
strips the label so it never reaches the committed text.

* feat(installer): build cn-en translations into the local dictionary

build-dictionary.py gains a cn-en-translations stage that loads
sources/cn-en/machine-translations.txt from msime-dictionary into
zh_en_glosses verbatim, keeping every sense instead of the two the ECDICT
derivation keeps. It runs after english-glosses and before
custom-translations, so it overrides ECDICT and custom/translations.txt
still overrides it.

Local full test packages now always build the dictionary from the sibling
msime-dictionary checkout instead of downloading the product-lock release:
Invoke-LocalTest.ps1 and prepare-package-inputs.ps1 call
build-dictionary.py --if-stale, which skips only when out/ was built from
the current clean source commit by the current builder. CI and releases
still take the dictionary from product-lock.json.
2026-10-10 21:17:03 +08:00

26 lines
1.3 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 打完整测试包(installer\test.ps1)前把仓外输入准备到位:
# - neural-model\sentence-model.safetensors / sentence-model-desktop.safetensors
# - language-model\sc.lm
# - MetasequoiaImeDict\out\ 下的词库:用 build-dictionary.py 从本仓同级的 msime-dictionary 构建,不下载 Release
# 模型按各自的锁校验 SHA256;全部是幂等的:已就绪就直接跳过。
[CmdletBinding()]
param(
# 忽略已有文件,强制重新下载 / 重新转换 / 重新构建词库。
[switch]$Force
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
& (Join-Path $PSScriptRoot 'fetch-neural-model.ps1') -Force:$Force
& (Join-Path $PSScriptRoot 'build-language-model.ps1') -Force:$Force
# 词库。本地测试包一律从 msime-dictionary 文本源数据构建(默认读本仓同级目录,可用环境变量
# MSIME_DICTIONARY 指定);源数据提交和构建脚本都没变、工作区干净时 --if-stale 直接跳过。
# CI 与正式发布仍按 product-lock.json 取 dict-* release,不走这里。
$buildDictionary = Join-Path $PSScriptRoot 'build-dictionary.py'
if ($Force) { python $buildDictionary } else { python $buildDictionary --if-stale }
if ($LASTEXITCODE -ne 0) { throw "从 msime-dictionary 构建词库失败($LASTEXITCODE)" }
Write-Host '全部就绪,可以运行 .\installer\test.ps1。'