Skip to content

Releases

0.1.0

Choose a tag to compare

@SergeyShk SergeyShk released this 23 Nov 06:35
011eaf6

The first release of esSyntax, a fast dependency parser of Spanish with a Rust core and a Python API. For every word of a sentence it finds the head and the Universal Dependencies relation. The anySeg segmenter splits the text into sentences and words, and the esMorph morphological analyzer gives the parts of speech and features.

pip install essyntax

Parser

  • Parser() loads the model of the package in about 5 ms, once per process; Parser(path) loads a model from a file.
  • parse_text parses a text and returns an anySeg document with the columns lemma, upos, feats, head and deprel; multiword tokens (del = de + el, dámelo = da + me + lo) stay in the result, and anySeg writes it as CoNLL-U.
  • annotate fills the heads and relations of an anySeg document already tagged by esMorph.
  • parse parses a sentence with its own parts of speech (the 17 UD parts of speech) and features (CoNLL-U notation or a dictionary, as esMorph gives them); parse_many parses many sentences, those of close length four at once.
  • With probs=True every word also gets the probability of its head and of its relation.
  • Parsing runs without the GIL, so threads with one parser work in parallel; on Python 3.14t and 3.15t the module does not enable the GIL. The parser is pickled.
  • The essyntax command writes CoNLL-U from text, read by paragraphs as a stream, or from CoNLL-U with parts of speech and features.

Model

  • A bidirectional LSTM (2 layers of 128) over the form, the endings, the part of speech and the esMorph features; the heads are a biaffine score and the tree with one root (the Chu - Liu - Edmonds algorithm), non-projective trees included; 45 UD relations with subtypes.
  • 2.4 million parameters in int8, 2.9 MB; the model is built into the extension module.
  • Trained on UD Spanish AnCora and UD Spanish GSD of the UD 2.19 release (836 thousand words) with a treebank marker, tagged by esMorph in context, as users get them; texts are parsed in the conventions of AnCora.
  • Sentences longer than 256 words, a text without punctuation for example, are parsed in time linear in the length.
  • The license of the model is CC BY-SA 4.0, of the code MIT.

Quality

LAS from raw text on the test parts of the UD 2.19 treebanks (CoNLL 2018 script, punctuation included), %; every system splits the text into sentences and words itself:

System AnCora GSD PUD COSER
esSyntax 89.25 80.95 81.97 65.52
spaCy es_core_news_sm 79.77 70.48 72.82 59.24
spaCy es_dep_news_trf 85.01 74.45 75.85 62.73
Stanza 89.19 84.89 83.99 65.43
Stanza ancora 90.90 80.20 81.41 66.76
Stanza accurate 90.67 87.14 85.17 66.47
UDPipe 1 78.73 68.48 72.19 58.24

Stanza and Stanza accurate are trained on AnCora and GSD, whose conventions PUD shares; the other models on AnCora.

Speed

Gold words of AnCora test (53 622 words), one thread, Apple M3 Pro, words per second, together with the tagging (for esSyntax, by esMorph):

System Words/s Loading, s Memory, MB
esSyntax 31 253 0.01 120
spaCy es_core_news_sm 34 069 1.77 743
UDPipe 1 6 155 0.82 222
spaCy es_dep_news_trf 1 332 2.48 2 642
Stanza 1 143 2.85 3 535
Stanza accurate 424 3.98 4 150

Stanza accurate was measured on the first 20 034 words, so its memory is not comparable. With ready tags parse_many parses about 40 thousand words per second, from Rust and from Python.

Platforms

abi3 wheels for Python 3.11+ on Linux (x86_64 and aarch64, manylinux and musllinux), macOS (Intel and Apple Silicon) and Windows (x64 and arm64), and wheels of their own for the free-threaded Python 3.14t and 3.15t; the model is part of the package. On other platforms the package is built from source, which needs Rust 1.88 or newer. The core is published on crates.io as the crate essyntax; its model is the file data/es-syntax.bin of this tag.

The comparison with spaCy md and lg, the parse of gold words and the conditions of the measurement are on the Comparison page. Documentation: https://sergeyshk.github.io/esSyntax/