Skip to main content

HuSpaCy: industrial strength Hungarian natural language processing

Project description

project logo

python version spacy PyPI - Wheel PyPI version Demo
Downloads Downloads Hits stars

HuSpaCy is a spaCy library providing industrial-strength Hungarian language processing facilities through spaCy models. The released pipelines consist of a tokenizer, sentence splitter, lemmatizer, tagger (predicting morphological features as well), dependency parser and a named entity recognition module. Word and phrase embeddings are also available through spaCy's API. All models have high throughput, decent memory usage and close to state-of-the-art accuracy. A live demo is available here, model releases are published to Hugging Face Hub.

This repository contains material to build HuSpaCy and all of its models in a reproducible way.


To get started using the tool, first, we need to download one of the models. The easiest way to achieve this is to install huspacy (from PyPI) and then fetch a model through its API.

pip install huspacy
import huspacy

# Download the latest CPU optimized model

Install the models directly

You can install the latest models directly from 🤗 Hugging Face Hub:

  • CPU optimized large model: pip install
  • GPU optimized transformers model: pip install

To speed up inference on GPUs, CUDA should be installed as described in

Read more on the models here


HuSpaCy is fully compatible with spaCy's API, newcomers can easily get started with spaCy 101 guide.

Although HuSpacy models can be loaded with spacy.load(...), the tool provides convenience methods to easily access downloaded models.

# Load the model using spacy.load(...)
import spacy
nlp = spacy.load("hu_core_news_lg")
# Load the default large model (if downloaded)
import huspacy
nlp = huspacy.load()
# Load the model directly as a module
import hu_core_news_lg
nlp = hu_core_news_lg.load()

To process texts, you can simply call the loaded model (i.e. the nlp callable object)

doc = nlp("Csiribiri csiribiri zabszalma - négy csillag közt alszom ma.")

As HuSpaCy is built on spaCy, the returned doc document contains all the annotations given by the pipeline components.

API Documentation is available in our website.

Models overview

We provide several pretrained models:

  1. hu_core_news_lg is a CNN-based large model which achieves a good balance between accuracy and processing speed. This default model provides tokenization, sentence splitting, part-of-speech tagging (UD labels w/ detailed morphosyntactic features), lemmatization, dependency parsing and named entity recognition and ships with pretrained word vectors.
  2. hu_core_news_trf is built on huBERT and provides the same functionality as the large model except the word vectors. It comes with much higher accuracy in the price of increased computational resource usage. We suggest using it with GPU support.
  3. hu_core_news_md greatly improves on hu_core_news_lg's throughput by loosing some accuracy. This model could be a good choice when processing speed is crucial.

HuSpaCy's model versions follows spaCy's versioning scheme.

A demo of the models is available at Hugging Face Spaces.

To read more about the model's architecture we suggest reading the relevant sections from spaCy's documentation.


Models md lg trf
Embeddings 100d floret 300d floret transformer: huBert
Target hardwer CPU CPU GPU
Accuracy ⭑⭑⭑⭒ ⭑⭑⭑⭑ ⭑⭑⭑⭑⭒
Resource usage ⭑⭑⭑⭑⭑ ⭑⭑⭑⭑ ⭑⭑


If you use any of the models or HuSpaCy as library in your research, please cite this paper:

  title = {{HuSpaCy: an industrial-strength Hungarian natural language processing toolkit}},
  booktitle = {{XVIII. Magyar Sz{\'a}m{\'\i}t{\'o}g{\'e}pes Nyelv{\'e}szeti Konferencia}},
  author = {Orosz, Gy{\"o}rgy and Sz{\' a}nt{\' o}, Zsolt and Berkecz, P{\' e}ter and Szab{\' o}, Gerg{\H o} and Farkas, Rich{\' a}rd}, 
  location = {{Szeged}},
  year = {2022},

Additionally, please indicate the version of the model you used so that your research can be reproduced.


For feature requests, issues and bugs please use the GitHub Issue Tracker. Otherwise, reach out to us in the Discussion Forum.


HuSpaCy is implemented in the SzegedAI team, coordinated by Orosz György in the Hungarian AI National Laboratory, MILAB program.


This library is released under the Apache 2.0 License

Trained models have their own license (CC BY-SA 4.0) as described on the models page.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release. See tutorial on generating distribution archives.

Built Distribution

huspacy-0.6.0-py3-none-any.whl (91.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page