Skip to main content

License: MIT Python 3.10 Release PyPI Build

Greynir

GreynirEngine

A fast, efficient natural language processing engine for Icelandic

Overview

Greynir is a Python 3 (>=3.10) package, published by Miðeind ehf., for working with Icelandic natural language text. Greynir can parse text into sentence trees, find lemmas, inflect noun phrases, assign part-of-speech tags and much more.

Greynir's sentence trees can inter alia be used to extract information from text, for instance about people, titles, entities, facts, actions and opinions.

Full documentation for Greynir is available here.

Greynir is the engine of Greynir.is, a natural-language front end for a database of over 10 million sentences parsed from Icelandic news articles, and Embla, a voice-driven virtual assistant app for smart devices such as iOS and Android phones.

Greynir includes a hand-written context-free grammar for the Icelandic language, consisting of over 7,000 lines of grammatical productions in extended Backus-Naur format. Its fast C++ parser core is able to cope with long and ambiguous sentences, using an Earley-type parser as enhanced by Scott and Johnstone.

Greynir employs the Tokenizer package, by the same authors, to tokenize text, and uses BinPackage as its database of Icelandic vocabulary and morphology.

Examples

Use Greynir to easily inflect noun phrases

from reynir import NounPhrase as Nl

# Create a NounPhrase ('nafnliður') object
karfa = Nl("þrír lúxus-miðar á Star Wars og tveir brimsaltir pokar af poppi")

# Print the NounPhrase in the correct case for each context
# (þf=þolfall/accusative, þgf=þágufall/dative). Note that
# the NounPhrase class implements __format__(), allowing you
# to use the case as a format specification, for instance in f-strings.

print(f"Þú keyptir {karfa:þf}.")
print(f"Hér er kvittunin þín fyrir {karfa:þgf}.")

The program outputs the following text, correctly inflected:

Þú keyptir þrjá lúxus-miða á Star Wars og tvo brimsalta poka af poppi.
Hér er kvittunin þín fyrir þremur lúxus-miðum á Star Wars og tveimur brimsöltum pokum af poppi.

Use Greynir to parse a sentence

>>> from reynir import Greynir
>>> g = Greynir()
>>> sent = g.parse_single("Ása sá sól.")
>>> print(sent.tree.view)
P                               # Root
+-S-MAIN                        # Main sentence
    +-IP                          # Inflected phrase
    +-NP-SUBJ                   # Noun phrase, subject
        +-no_et_nf_kvk: 'Ása'     # Noun, singular, nominative, feminine
    +-VP                        # Verb phrase containing arguments
        +-VP                      # Verb phrase containing verb
        +-so_1_þf_et_p3: 'sá'   # Verb, 1 accusative arg, singular, 3rd p
        +-NP-OBJ                  # Noun phrase, object
        +-no_et_þf_kvk: 'sól'   # Noun, singular, accusative, feminine
+-'.'                           # Punctuation
>>> sent.tree.nouns
['Ása', 'sól']
>>> sent.tree.verbs
['sjá']
>>> sent.tree.flat
'P S-MAIN IP NP-SUBJ no_et_nf_kvk /NP-SUBJ VP so_1_þf_et_p3
    NP-OBJ no_et_þf_kvk /NP-OBJ /VP /IP /S-MAIN p /P'
>>> # The subject noun phrase (S.IP.NP also works)
>>> sent.tree.S.IP.NP_SUBJ.lemmas
['Ása']
>>> # The verb phrase
>>> sent.tree.S.IP.VP.lemmas
['sjá', 'sól']
>>> # The object within the verb phrase (S.IP.VP.NP also works)
>>> sent.tree.S.IP.VP.NP_OBJ.lemmas
['sól']

Extracting lemmas and POS tags for web display

Greynir preserves the original text of each token, including surrounding whitespace. This allows you to reconstruct the exact original input while annotating it with linguistic information such as lemmas and part-of-speech (POS) tags.

from reynir import Greynir

g = Greynir()
sent = g.parse_single("Ása   sá   sól.")

# Build a map from token index to terminal node
terminal_map = {node.index: node for node in sent.terminal_nodes}

html_parts = []
for i, tok in enumerate(sent.tokens):
    # tok.original preserves the original text with spacing
    original = tok.original or ""
    if i in terminal_map:
        node = terminal_map[i]
        # Wrap with linguistic info (lemma and POS tag)
        html_parts.append(
            f'<span data-lemma="{node.lemma}" data-pos="{node.tcat}">'
            f'{original}</span>'
        )
    else:
        html_parts.append(original)

html = "".join(html_parts)
print(html)

The program outputs the following HTML, with the original spacing preserved and each token annotated with its lemma and POS tag (no=noun, so=verb):

<span data-lemma="Ása" data-pos="no">Ása</span><span data-lemma="sjá" data-pos="so">   sá</span><span data-lemma="sól" data-pos="no">   sól</span><span data-lemma="." data-pos="">.</span>

Prerequisites

This package runs on CPython 3.10 or newer, and on PyPy 3.11 or newer.

To find out which version of Python you have, enter:

python --version

If a binary wheel package isn't available on PyPI for your system, you may need to have the python3-dev package (or its Windows equivalent) installed on your system to set up Greynir successfully. This is because a source distribution install requires a C++ compiler and linker:

# Debian or Ubuntu
sudo apt-get install python3-dev

Depending on your system, you may also need to install libffi-dev:

# Debian or Ubuntu
sudo apt-get install libffi-dev

Installation

To install this package, assuming Python 3 is your default Python:

pip install reynir

If you have git installed and want to be able to edit the source, do like so:

git clone https://github.com/mideind/GreynirEngine
cd GreynirEngine
# [ Activate your virtualenv here if you have one ]
pip install -e .

The package source code is in GreynirEngine/src/reynir.

Tests

To run the built-in tests, cd to your GreynirEngine subdirectory and, using uv, run:

uv sync
uv run pytest

uv sync installs the development tools (pytest, ruff, mypy) along with the package; uv sync --extra dev does the same. Without uv, install them into your virtualenv with pip install -e ".[dev]" and run python -m pytest.

Evaluation

A parsing test pipeline for different parsing schemas, including the Greynir schema, has been developed. It is available here.

Documentation

Please consult Greynir's documentation for detailed installation instructions, a quickstart guide, and reference information, as well as important information about copyright and licensing.

Troubleshooting

GreynirEngine uses a lock file, located alongside the binary grammar file within the package directory (reynir/Greynir.grammar.bin.lock), to serialize the (re)generation of the binary grammar between processes. If a process gets stuck holding the lock, parser initialization fails after a timeout with an error message identifying the lock file. Terminate the process holding the lock, or - if no such process exists - delete the lock file named in the error message, and try again.

Greynir is Copyright © 2016-2026 by Miðeind ehf.. The original author of this software is Vilhjálmur Þorsteinsson.

Miðeind ehf.

This software is licensed under the MIT License:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

If you would like to use this software in ways that are incompatible with the standard MIT license, contact Miðeind ehf. to negotiate custom arrangements.


GreynirEngine indirectly embeds the Database of Icelandic Morphology, (Beygingarlýsing íslensks nútímamáls), abbreviated BÍN. GreynirEngine does not claim any endorsement by the BÍN authors or copyright holders.

The BÍN source data are publicly available under the CC BY-SA 4.0 license, as further detailed here in English and here in Icelandic.

In accordance with the BÍN license terms, credit is hereby given as follows:

Beygingarlýsing íslensks nútímamáls. Stofnun Árna Magnússonar í íslenskum fræðum. Höfundur og ritstjóri Kristín Bjarnadóttir.

Metadata

Release files for reynir 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reynir 4.0.0
File Size Uploaded Provenance Actions
reynir-4.0.0.tar.gz 534.4 kB With provenance Details for reynir-4.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for reynir 4.0.0
File Actions
reynir-4.0.0-pp311-pypy311_pp73-win_amd64.whl PyPy 3.11 PyPy 3.11 7.3 Windows x86-64 Details for reynir-4.0.0-pp311-pypy311_pp73-win_amd64.whl
reynir-4.0.0-pp311-pypy311_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl PyPy 3.11 PyPy 3.11 7.3 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details for reynir-4.0.0-pp311-pypy311_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
reynir-4.0.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl PyPy 3.11 PyPy 3.11 7.3 macOS 11.0+ ARM64 Details for reynir-4.0.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl
reynir-4.0.0-pp311-pypy311_pp73-macosx_10_15_x86_64.whl PyPy 3.11 PyPy 3.11 7.3 macOS 10.15+ x86-64 Details for reynir-4.0.0-pp311-pypy311_pp73-macosx_10_15_x86_64.whl
reynir-4.0.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for reynir-4.0.0-cp310-abi3-win_amd64.whl
reynir-4.0.0-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details for reynir-4.0.0-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
reynir-4.0.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for reynir-4.0.0-cp310-abi3-macosx_11_0_arm64.whl
reynir-4.0.0-cp310-abi3-macosx_10_9_x86_64.whl CPython 3.10 abi3 macOS 10.9+ x86-64 Details for reynir-4.0.0-cp310-abi3-macosx_10_9_x86_64.whl

Total release size: 5.7 MB

Release files / reynir-4.0.0.tar.gz

Download URL reynir-4.0.0.tar.gz
Size 534.4 kB
Tags Source
SHA-256 checksum
How to use checksums
19725375160222fb8c08d8b45e3a1cd2848f29a21880b7f6f234156bad27adc4
BLAKE2b-256 checksum
How to use checksums
a21d564ccda1acee2b4c6ba6eb727515c63f0a10870dda29e31ecd4715ba3a53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / reynir-4.0.0-pp311-pypy311_pp73-win_amd64.whl

Download URL reynir-4.0.0-pp311-pypy311_pp73-win_amd64.whl
Size 723.5 kB
Tags PyPy 3.11 PyPy 3.11 7.3 Windows x86-64
SHA-256 checksum
How to use checksums
c415193df1f379c5ee172f096177eff998c78250bd4832bb229f44641db2039d
BLAKE2b-256 checksum
How to use checksums
842186f0269b96700d74eaa46f8345a0e7bd492c54779bc018ec92be66fee4c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / reynir-4.0.0-pp311-pypy311_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL reynir-4.0.0-pp311-pypy311_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 529.5 kB
Tags Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 PyPy 3.11 PyPy 3.11 7.3
SHA-256 checksum
How to use checksums
5a6dd378818115e10b19891756c4263dfe6dabc2700db9b6c218307a5d1b86ce
BLAKE2b-256 checksum
How to use checksums
3136d2d775af7c58ac4ff7f3b4371eb9709a804bfcc2be2e47cada43d9cadd6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / reynir-4.0.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl

Download URL reynir-4.0.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl
Size 519.7 kB
Tags PyPy 3.11 PyPy 3.11 7.3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
998de654ec0d85460626eca60c27d60b1276c5fc9d0017b9be47ec092e48b2db
BLAKE2b-256 checksum
How to use checksums
dab86c03127c5d713b7f49f7f468b83a5550837bd373d96b7dad0e0e20c62932
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / reynir-4.0.0-pp311-pypy311_pp73-macosx_10_15_x86_64.whl

Download URL reynir-4.0.0-pp311-pypy311_pp73-macosx_10_15_x86_64.whl
Size 524.5 kB
Tags PyPy 3.11 PyPy 3.11 7.3 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
9605e68ebbf076c6f6568fd4999931300b9e83dc3d6fec4588d9b5f401213daa
BLAKE2b-256 checksum
How to use checksums
23a7a16ffadc07cec99c874ff12dc6ab2969ad4e2d83227ceb37e66987a41aaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / reynir-4.0.0-cp310-abi3-win_amd64.whl

Download URL reynir-4.0.0-cp310-abi3-win_amd64.whl
Size 711.7 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
81366faeb984f2cc280051c621289365d29a6199c69a85806aa18ed31494799e
BLAKE2b-256 checksum
How to use checksums
9f634e9857b06959a54e9de8a63c40e67c79d890e74da2c4e7042a45eaf30315
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / reynir-4.0.0-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL reynir-4.0.0-cp310-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 1.1 MB
Tags CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
689da2d8608d20d221a1d848731bfb8dad4666ba7f7fad99240eb746e6ded157
BLAKE2b-256 checksum
How to use checksums
811b5452f7467ae2d9ef2143bd7e32bd0de92ac5308d2cc4de24fc2ded1d3c7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / reynir-4.0.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL reynir-4.0.0-cp310-abi3-macosx_11_0_arm64.whl
Size 530.5 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
184d5dd692886c252f0c6f0fcf4ce9f9db52aa1f308978a4fc11c9cc9cc1c7ea
BLAKE2b-256 checksum
How to use checksums
71b66ebf68079a147fd510f71042f21b2b62971a2a6578f3f6a4dce16872b0fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / reynir-4.0.0-cp310-abi3-macosx_10_9_x86_64.whl

Download URL reynir-4.0.0-cp310-abi3-macosx_10_9_x86_64.whl
Size 535.0 kB
Tags CPython 3.10 abi3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
5c1f1a23df01aed99f8a3a7b461e02b4bdd7e043c8daa750687364b02384bce0
BLAKE2b-256 checksum
How to use checksums
2c0d31b078b136cc2f0c996bdadee08c746b3418602564806da54e9ef6103820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for reynir 4.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for reynir-4.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.0.0 This release

9 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page