Skip to content

esSyntax

esSyntax

esSyntax is a dependency parser of Spanish: a Rust core with a Python API. For every word of a sentence the parser finds its head and the relation between them in the Universal Dependencies annotation. The anySeg segmenter splits the text into sentences and words, and the esMorph morphological analyzer gives the parts of speech and features.

Features

  • Parser


    The head and the relation of every word of a text, of an anySeg document or of a sentence with its tags; many sentences at once, the probabilities of the heads and the relations, threads without the GIL

    Parser

  • Command line


    The essyntax command: CoNLL-U from text or from CoNLL-U with parts of speech and features, files and streams by paragraphs

    The essyntax command

  • Model


    A BiLSTM over the words and their esMorph tags, biaffine heads and a tree with one root, trained on UD Spanish AnCora and GSD; 2.9 MB built into the package

    Model

  • Comparison


    Quality and speed compared with other parsers of Spanish

    Comparison

How it works

A sentence goes through three steps: the anySeg segmenter splits the text into tokens and their words (del is de + el), the esMorph morphological analyzer gives every word its part of speech and features - gender, number, person, mood - and esSyntax uses the words and their tags to find which word every word depends on and how: the subject depends on the verb, a determiner on its noun, a preposition on the word it introduces.

How esSyntax parses a sentence: the text, the words, the parts of speech and features, the dependency tree

Installation

Python 3.11 or newer is required.

pip install essyntax

Prebuilt wheels, building from source and the Rust crate are described on the Installation page.

Quick start

from essyntax import Parser

parser = Parser()
document = parser.parse_text("Mi madre lava la ropa.")
[(word.form, word.head, word.deprel) for word in document.words]
[('Mi', 2, 'det'), ('madre', 3, 'nsubj'), ('lava', 0, 'root'), ('la', 5, 'det'), ('ropa', 3, 'obj'), ('.', 3, 'punct')]

The head is the number of a word in the sentence starting from 1, and the root has 0. The methods of the parser are on the Parser page, and the essyntax command parses files and streams into CoNLL-U.