Skip to main content

nafnagreining

Icelandic language detection and extraction of person names, places and locations.

>>> from nafnagreining import isIcelandic, extractEntities
>>> text = "Í dag fór ég í Hólavallakirkjugarð með Önnu móður minni. Hún kom frá Breiðholti."
>>> isIcelandic(text)
True
>>> extractEntities(text)
{'names': ['Anna'], 'places': ['Breiðholt'], 'locations': ['Hólavallakirkjugarður']}
  • isIcelandic(s) -> bool decides whether a text is Icelandic. On random Wikipedia text in 13 languages it scores about 93% balanced accuracy. Faroese is the language it most often confuses with Icelandic.
  • extractEntities(s) -> Entities returns a dict with the keys names, places and locations. Each key holds a list in the nominative ("Önnu" → "Anna", "Háskóla Íslands" → "Háskóli Íslands"), in order of first appearance and without duplicates. The input must be Icelandic, so check it with isIcelandic first.

Install

From PyPI (once published):

pip install nafnagreining
uv add nafnagreining

Directly from git:

pip install "nafnagreining @ git+https://github.com/cylq-is/nafnagreining.git"
uv add "nafnagreining @ git+https://github.com/cylq-is/nafnagreining.git"
# a specific tag or commit:
uv add "nafnagreining @ git+https://github.com/cylq-is/nafnagreining.git@v0.1.0"

Requires Python 3.10+. The islenska dependency ships prebuilt wheels for Linux (glibc, x86_64 and ARM64) and macOS. Other platforms have to compile it from source, which needs a C++17 compiler.

Development

uv sync                       # create .venv with the package and dev tools
uv run pytest -s              # run the tests and print accuracy reports
uv run python tests/test_icelandic.py --refresh   # re-download the Wikipedia test text
uv run python tools/build_wordlist.py             # rebuild the Icelandic word list
uv build                      # build sdist and wheel into dist/

Releasing

Releases are automatic. Every pull request runs the tests on Linux and macOS. When a pull request is merged to main, the release workflow:

  1. bumps the version in pyproject.toml,
  2. commits it as Release vX.Y.Z and tags it,
  3. publishes to PyPI through trusted publishing (no token stored),
  4. creates a GitHub release.

Choose the bump size with a label on the pull request:

Label Bump
(none) patch: 1.2.3 → 1.2.4
release:minor minor: 1.2.3 → 1.3.0
release:major major: 1.2.3 → 2.0.0
release:skip no release (docs, CI, tests)

Direct pushes to main are not released. If the PyPI upload fails, use Re-run failed jobs on the workflow run. That publishes the same tag again without bumping the version a second time.

Data and licences

The code is MIT licensed (see LICENSE).

  • Icelandic word list (src/nafnagreining/data/is_words.txt.gz): generated from hunspell-is, which is based on Icelandic Wiktionary. Licensed CC BY-SA 3.0; see src/nafnagreining/data/LICENSE-wordlist.txt.
  • BÍN (Beygingarlýsing íslensks nútímamáls), © Árni Magnússon Institute for Icelandic Studies, CC BY-SA 4.0. It is used through Miðeind's islenska package and is not bundled here.
  • Test text in tests/data/wiki/ comes from Wikipedia (CC BY-SA 4.0) and is not included in the built package.

Metadata

Release files for nafnagreining 0.1.1

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

Source distribution (sdist)

Source distribution for nafnagreining 0.1.1
File Size Uploaded Provenance Actions
nafnagreining-0.1.1.tar.gz 826.4 kB Without provenance Details for nafnagreining-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nafnagreining 0.1.1
File Interpreter ABI Platform Actions
nafnagreining-0.1.1-py3-none-any.whl Python 3 none any Details for nafnagreining-0.1.1-py3-none-any.whl

Total release size: 1.7 MB

Release files / nafnagreining-0.1.1.tar.gz

Download URL nafnagreining-0.1.1.tar.gz
Size 826.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1c87e56bd8c8d02114463f704cd5fed48537d5c048017414b483fc003248083c
BLAKE2b-256 checksum
How to use checksums
bd75dcfb9f4fdd5c459c0dba73baa22fdb5b3e2e310cd62e17d61351e32f8118
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.2 {"installer":{"name":"uv","version":"0.13.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / nafnagreining-0.1.1-py3-none-any.whl

Download URL nafnagreining-0.1.1-py3-none-any.whl
Size 827.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c1c3ea7863d0617c468db8bb9446d2be7712d7ac288705fcca12bdb5896321b
BLAKE2b-256 checksum
How to use checksums
0f7988407b1d1d53a704716f79558f7b00526bb86785859ff962a99c96a43a80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.2 {"installer":{"name":"uv","version":"0.13.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for nafnagreining 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

0.1.1 This release

2 release files No 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