Views
No views yet
cascade.js (a COUNTRY span that is actually a known city — e.g.
"a Paris trip" — becomes a CITY). Clean field_f1 0.948 → 0.952, typed span-F1 0.969.(text → "<entity> <city> <country>") pairs is a small,
deterministic, parameter-free step (a positional linker + city→country gazetteer + English
country canonicalization) that runs as plain JavaScript alongside the model. This repo
bundles everything for a complete in-browser extractor in demo/:demo/index.html — a ready-to-run UI (loads this model via transformers.js).demo/cascade.js — the linker + gazetteer lookup + country canonicalization.demo/city_country_gazetteer.json — the full ~1.03M-city GeoNames gazetteer (city → country).demo/city_country_multi.json — ambiguous-name table (disambiguated by a country named nearby).demo/country_lookup.json — surface-form → English country canonicalization.1# download this repo, then serve the demo folder over HTTP:
2python3 -m http.server -d demo 8000 # open http://localhost:80001import { pipeline } from "@huggingface/transformers";
2
3// fp16 computes correctly on WebGPU; on the WASM backend use fp32 (WASM has no fp16
4// kernels). int8 is intentionally NOT shipped: dynamic quantization was too lossy and
5// dropped entities on some inputs.
6const dtype = navigator.gpu ? "fp16" : "fp32";
7const device = navigator.gpu ? "webgpu" : "wasm";
8const tagger = await pipeline(
9 "token-classification",
10 "Berk/multilingual-place-extractor-mdeberta-13lang-onnx",
11 { dtype, device }
12);
13const tokens = await tagger("I booked Hotel Lungomare in Rimini then flew to Bologna",
14 { ignore_labels: [] });
15// tokens: [{ entity: "B-ENTITY", start, end, ... }, ...] -> feed to cascade.jsconfig.json — DebertaV2ForTokenClassification, id2label = the 7 BIO tags.tokenizer.json, tokenizer_config.json — the mDeBERTa-v3 SentencePiece tokenizer.onnx/model_fp16.onnx — fp16 graph (~557 MB), for WebGPU (dtype: "fp16"). Fast.onnx/model.onnx — fp32 graph (~1.1 GB), for the WASM backend (dtype: "fp32").
Both reproduce the PyTorch token predictions; the 251k-token embedding table dominates size.Berk/multilingual-place-extractor-mdeberta-13lang.