AI candidate selection on Windows and Linux
Python port of the reranker: core/lm.py runs the same CKIP gpt2-tiny-chinese model with numpy (batched per candidate length, scores match the Swift and reference implementations), Converter.kbest, core/reranker.py (modes, time budget, pause after overruns, cache), core/system_monitor.py (Windows: CPU usage and battery saver; Linux: load average, thermal zones, low-power profile and low battery) and core/ai.py (settings.json, background model loading, status line). Windows: numpy wheels for PIME's 32-bit Python 3.8 (PIME 1.3) and 3.15 (PIME 2) are bundled under autozhuyin/vendor and picked by Python version; a settings menu on the taskbar IME icon and the language bar (left click on the icon toggles English mode). Linux: install.sh uses the system numpy or downloads the matching wheel from PyPI (tools/fetch_numpy.py, SHA-256 checked); an IBus settings menu. Without numpy or the model the input method works as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ VERSION="$(python3 -I -c 'import json,sys; print(json.load(open(sys.argv[1]))["v
|
||||
NAME="AutoZhuyin-Linux-$VERSION"
|
||||
OUT="build/$NAME"
|
||||
|
||||
[ -s build/lm/lm.bin ] || scripts/fetch-lm.sh >/dev/null # "AI 選字" model
|
||||
python3 -I windows/tools/build_data.py
|
||||
(cd windows && python3 -m unittest discover -q tests)
|
||||
python3 -m unittest discover -q -s linux/tests
|
||||
@@ -21,7 +22,9 @@ mkdir -p "$OUT/autozhuyin"
|
||||
rsync -a --exclude __pycache__ --exclude '*.pyc' \
|
||||
windows/autozhuyin/__init__.py windows/autozhuyin/core windows/autozhuyin/data "$OUT/autozhuyin/"
|
||||
cp linux/autozhuyin_ibus.py linux/installer/install.sh linux/installer/uninstall.sh linux/installer/README.txt \
|
||||
THIRD_PARTY_LICENSES.txt "$OUT/"
|
||||
THIRD_PARTY_LICENSES.txt licenses/GPL-3.0.txt "$OUT/"
|
||||
mkdir -p "$OUT/tools"
|
||||
cp windows/tools/fetch_numpy.py "$OUT/tools/" # install.sh downloads numpy if the system has none
|
||||
echo "$VERSION" > "$OUT/version.txt"
|
||||
sips -s format png -z 64 64 build/icon.tiff --out "$OUT/icon.png" >/dev/null
|
||||
chmod +x "$OUT/install.sh" "$OUT/uninstall.sh" "$OUT/autozhuyin_ibus.py"
|
||||
|
||||
@@ -8,6 +8,7 @@ VERSION="$(python3 -I -c 'import json,sys; print(json.load(open(sys.argv[1]))["v
|
||||
NAME="AutoZhuyin-Windows-$VERSION"
|
||||
OUT="build/$NAME"
|
||||
|
||||
[ -s build/lm/lm.bin ] || scripts/fetch-lm.sh >/dev/null # "AI 選字" model
|
||||
python3 -I windows/tools/build_data.py
|
||||
(cd windows && python3 -m unittest discover -q tests)
|
||||
|
||||
@@ -29,6 +30,14 @@ done
|
||||
# Third-party notices: next to the installer and inside the installed folder.
|
||||
sed 's/$/\r/' THIRD_PARTY_LICENSES.txt > "$OUT/THIRD_PARTY_LICENSES.txt"
|
||||
cp "$OUT/THIRD_PARTY_LICENSES.txt" "$OUT/autozhuyin/"
|
||||
sed 's/$/\r/' licenses/GPL-3.0.txt > "$OUT/autozhuyin/GPL-3.0.txt"
|
||||
|
||||
# numpy for "AI 選字", for both Pythons PIME ships (1.3: 3.8, 2.x: 3.15; both 32-bit).
|
||||
for tag in cp38 cp315; do
|
||||
[ -d "build/numpy-vendor/$tag" ] || python3 -I windows/tools/fetch_numpy.py build/numpy-vendor "$tag" win32
|
||||
done
|
||||
mkdir -p "$OUT/autozhuyin/vendor"
|
||||
cp -R build/numpy-vendor/cp38 build/numpy-vendor/cp315 "$OUT/autozhuyin/vendor/"
|
||||
|
||||
(cd build && zip -qr -X "$NAME.zip" "$NAME")
|
||||
echo "Built build/$NAME.zip"
|
||||
|
||||
Reference in New Issue
Block a user