Skip to main content

NormForm (v0.1.0 — Experimental)

NormForm standardizes Norwegian Bokmål (nob) and Nynorsk (nno) text by making consistent choices among contextually valid morphological alternatives, while guaranteeing that non-alternative text is never altered.

It also generates [alt1|alt2] morphological alternative brackets for ASR evaluation (AltMetrics), audits documents for internal morphological inconsistencies, extracts representative style steering words from reference texts, and runs high-throughput streaming corpus standardization on GPU.


Installation

pip install git+https://github.com/NationalLibraryOfNorway/normform.git
# Or with batch dataset extras (Parquet / Hugging Face Datasets):
pip install "normform[batch] @ git+https://github.com/NationalLibraryOfNorway/normform.git"

Quick Start

1. Command Line (normform)

# Standardize a sentence using the official Bokmål Redaksjonsnorm style:
normform standardize -t "Jenta kasta ballen i boken." --lang nob --style redaksjonsnorm

# Standardize a Nynorsk sentence using Nasjonalbiblioteknorm:
normform standardize -t "Me køyrde heim på laurdag." --lang nno --style nasjonalbiblioteknorm

# Standardize using custom steering prompt words:
normform standardize -t "Jenta hoppa høyt." -p "jenta,kasta,boka"

# Generate [alt1|alt2] morphological alternative brackets:
normform alternatives -t "Katta ligger på matta." --lang nob

# Audit a document for internal morphological inconsistencies (fast raw check):
normform audit -i document.txt --raw

# Extract top 10 representative style prompt words from a reference text:
normform extract-style -i reference_document.txt --lang nob -n 10

# High-throughput 1-GPU streaming corpus standardization (.jsonl, .parquet, or HF dataset):
normform batch -i corpus.jsonl -o corpus_standardized.jsonl \
  --lang nob --style NbAiLab/normform-bokmaal-redaksjonsnorm --preserve-unreviewed

2. Python API

from normform import Standardizer

# Initialize with a built-in style alias, Hugging Face repo ID, or local .yaml file:
std = Standardizer(lang="nob", style="redaksjonsnorm")

# Standardize text:
print(std("Katta ligger på matten."))

# Expand into [alt1|alt2] morphological alternative brackets:
print(std.alternatives("Katta ligger på matta."))

Managing & Sharing Styles on Hugging Face (normform styles)

Each NormForm style lives in its own Hugging Face dataset repository (containing style.yaml and a README.md style card).

# List official built-in styles and aliases:
normform styles list

# Pull an official style locally to inspect or customize it:
normform styles pull redaksjonsnorm -o my_custom_style.yaml

# Edit my_custom_style.yaml, then push it to your own private HF repo:
normform styles push -f my_custom_style.yaml --repo my-username/my-normform-style

# Use your custom HF style anywhere:
normform standardize -i document.txt --style my-username/my-normform-style

Official Pinned Models & Style Repositories

Language Two-Task Neural Model Official Style Repository Short Aliases
Bokmål (nob) NbAiLab/normform-bokmaal-multitask@eb83a85c52bea137e2bbb3ba95e29be3e9476923 NbAiLab/normform-bokmaal-redaksjonsnorm redaksjonsnorm, redaksjonsstil, bokmaal
Nynorsk (nno) NbAiLab/normform-nynorsk-multitask@350cf9d3aeeba2f390353f4147ef2910dff7b0ee NbAiLab/normform-nynorsk-nasjonalbiblioteknorm nasjonalbiblioteknorm, nasjonalbibliotekstil, nynorsk

License

Apache License 2.0. Created by Per Egil Kummervold and Magnus Breder Birkenes at the National Library of Norway (Nasjonalbiblioteket).

Metadata

Release files for normform 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 normform 0.1.0
File Size Uploaded Provenance Actions
normform-0.1.0.tar.gz 56.6 kB With provenance Details for normform-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 112.2 kB

Release files / normform-0.1.0.tar.gz

Download URL normform-0.1.0.tar.gz
Size 56.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6bf6c6315f6d2cd1af4e5cae4d6036bfb527d24e4db53860c91f4d091ac0834c
BLAKE2b-256 checksum
How to use checksums
d401020f595dc37948c74bf56224707a3c0ca001ea1a5dff48bd7c3dacb8c222
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 9, 2026.

Transparency log

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

Download URL normform-0.1.0-py3-none-any.whl
Size 55.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5173a46295b289eec9e87762b9927a8ed28e6461b656b06a155c93b2390f9ae
BLAKE2b-256 checksum
How to use checksums
5e722721dc6e67c694fcbe0dd64fa05b748098587c05ef06399c9d93986947c5
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 9, 2026.

Transparency log

Security for normform 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for normform-0.1.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 9, 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.

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