lopentu/ckiplab-bert-base-chinese-DottedWSD-onnx
DottedWSD (ckiplab-bert-base-chinese) — ONNX export for the browser
ONNX conversion of `lopentu/ckiplab-bert-base-chinese-DottedWSD`, the encoder-based word sense disambiguation model from Balancing Accuracy and Efficiency: Evaluating Encoder- and Decoder-Based Models for Word Sense Disambiguation and Regular Polysemy Detection (Chen, Lian & Hsieh, 2026; code: lopentu/dotted-wsd-public). Made so the model can run inside a web page with transformers.js; first used by the Sense River 語意河道 demo (https://lopentu.github.io/sindia/ciwn/sense-river/).
Input format
Sequence-pair classification, exactly as in dotted-wsd:
text = context with the target wrapped in angle brackets, e.g. 忽然看見江<心>浮現一團黑影。
text_pair = "{word},{CWN definition},{first CWN example}" one pair per candidate senseTake the positive-class logit (logits[:, 1]) of each candidate and softmax across the candidates of one token.
import { AutoTokenizer, AutoModelForSequenceClassification } from '@huggingface/transformers';
const repo = 'lopentu/ckiplab-bert-base-chinese-DottedWSD-onnx';
const tokenizer = await AutoTokenizer.from_pretrained(repo);
const model = await AutoModelForSequenceClassification.from_pretrained(repo, { dtype: 'q8' });
const inputs = tokenizer(probes, { text_pair: glosses, padding: true, truncation: true, max_length: 320 });
const { logits } = await model(inputs); // [n_candidates, 2]Candidate senses come from Chinese Wordnet (CWN) via CwnGraph. Trained on contemporary Taiwan Mandarin; expect domain shift on classical or Buddhist Chinese.
