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/
uv publish                    # upload to PyPI (needs a PyPI token)

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.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 nafnagreining 0.1.0
File Size Uploaded Provenance Actions
nafnagreining-0.1.0.tar.gz 825.7 kB Without provenance Details for nafnagreining-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.7 MB

Release files / nafnagreining-0.1.0.tar.gz

Download URL nafnagreining-0.1.0.tar.gz
Size 825.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e748465c83bda82850ceee68b221af47afbc0286e1f7401bbbdcd3a992032cd3
BLAKE2b-256 checksum
How to use checksums
d9b32fce09c718015ecc80762250ceea2a03b7290b33a363fc1bb311d9294a69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL nafnagreining-0.1.0-py3-none-any.whl
Size 826.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1d1bb60240b8dee740fa4c2219f92cf75e497d1224cc0eb9d944786b893ec4c
BLAKE2b-256 checksum
How to use checksums
b3baf5bed5ead71e20250c7dedecc34ac54e819e1f7e6f7e092d598eaed91a01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for nafnagreining 0.1.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.

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.0 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