Sparv Swedish Stanza models — ONNX

ONNX conversion of the Språkbanken Text Swedish Stanza models used by Sparv as its default Swedish analysis (sbx-swe-dependency-stanza-stanzasynt, doi:10.23695/v6s0-be16): SUC POS/MSD tagging, UD morphological features, lemmatisation and MambaDep dependency parsing (LAS 84.48 on TalbankenSBX test, per Språkbanken).

The weights are unchanged. The graphs re-implement stanza 1.10.1's eval-mode forward for one sentence and reproduce stanza's output exactly (pos, msd, ufeats, lemma, head, deprel: 100 % agreement on 1 249 sentences / 20 634 tokens, see parity.md in the conversion repository).

Used by the R package protoscribe (draft_dependencies()), which runs it through ONNX Runtime without Python.

Files

file inputs → outputs (all float32; ids are integer-valued floats)
pretrain.onnx ids [n] → vectors [n,100] (250 000-word embeddings)
tagger.onnx word [n], pretrained [n,100], chars [n,L], char_mask [n,L] → upos [n], xpos [n], feats [n,11]
lemma_encoder.onnx src [L] (SOS, chars, EOS), pos [1] → h_in [1,L+1,200], hn, cn [1,200], edit [1]
lemma_decoder.onnx token [1], hn, cn, h_in → next [1], hn_out, cn_out (one greedy step)
parser.onnx ROOT-prefixed, length m = n+1: word, lemma, upos, xpos [m], pretrained [m,100], chars, char_mask [m,L] → logp [m,m] (log-softmax over heads, [dependent, head]), deprel [m,m] (label id per pair)
vocab.json all vocabularies (id2unit lists; specials PAD=0 UNK=1 EMPTY=2 ROOT=3; lemma chars PAD UNK SOS EOS)
lemma_dict.json lemma word dictionary and (word, POS) composite dictionary
meta.json versions, sizes, sha256, provenance

Pipeline (what a caller must do)

  1. Map tokens: word and lemma lookups lower-cased; pretrained lookup lower-cased with spaces replaced by U+00A0; characters not lower-cased; unknown → UNK.
  2. Tagger → SUC POS (upos), SUC MSD (xpos, EMPTY → _), feats (keys in vocab.json order, EMPTY parts dropped, joined with |, empty → _).
  3. Lemma: composite dict (word, pos), else word dict, else greedy seq2seq (max 50 steps, stop at EOS) with edit class 1 = word, 2 = lower(word), 0 = decoded; empty or containing <UNK> → word; empty lemma → _.
  4. Parser on ROOT-prefixed inputs (ROOT id 3 everywhere, ROOT chars [3], xpos _ → EMPTY); decode logp with Chu-Liu-Edmonds (single root, stanza chuliu_edmonds_one_root); label of word j = deprel[j, head_j].

Licence and attribution

Models: CC-BY-4.0, © Språkbanken Text, University of Gothenburg — trained with Stanza on TalbankenSBX (dependencies), SUC3 (lemmas) and TalbankenSBX (tags). Stanza (Qi et al., 2020) is Apache-2.0.

Qi, P., Zhang, Y., Zhang, Y., Bolton, J., & Manning, C. D. (2020). Stanza: A Python natural language processing toolkit for many human languages. ACL 2020 System Demonstrations.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support