Swedish NLP toolkit for translators
Project description
🇸🇪 svlang
Swedish NLP toolkit for translators.
Detect anglicisms, check translation consistency, and split compound words — all from the command line or Python.
Installation
pip install svlang
# With .po file support
pip install svlang[po]
CLI Usage
Svengelska detector
Find unnecessary anglicisms in Swedish text:
$ svlang svengelska -t "Vi behöver implementera en ny approach"
⚠️ «implementera» → genomföra, införa
⚠️ «approach» → tillvägagångssätt, metod
$ svlang svengelska -f my_translation.txt
Consistency checker
Find identical source strings with different translations:
$ svlang consistency file1.po file2.po
⚠️ 2 inkonsistens(er) hittade:
Källa: «Save»
→ «Spara» (file1.po:12)
→ «Lagra» (file2.po:45)
# Also supports Qt .ts files
$ svlang consistency translations/*.ts
Compound splitter
Split Swedish compound words into components:
$ svlang compound barnbok solstol nattljus
barnbok → barn + bok
solstol → sol + stol
nattljus → natt + ljus
Python API
from svlang.checkers import SvengelskaChecker, ConsistencyChecker, CompoundSplitter
# Anglicisms
checker = SvengelskaChecker()
hits = checker.check("Ge mig lite feedback")
for h in hits:
print(f"{h.word} → {h.suggestion}")
# Consistency
con = ConsistencyChecker()
con.add("Save", "Spara", "file1.po:12")
con.add("Save", "Lagra", "file2.po:45")
for issue in con.check():
print(f"{issue.source}: {list(issue.translations.keys())}")
# Compound words
splitter = CompoundSplitter()
result = splitter.split("barnvagnshjul")
print(result.parts) # ["barn", "vagn", "hjul"]
Features
- 🔍 90+ anglicisms detected with Swedish alternatives (based on Språkrådet)
- 📊 Consistency checking across .po and .ts files
- 🧩 Compound word splitting with Swedish morphology (fogmorfem)
- 🖥️ CLI with colored output
- 📦 Zero dependencies (polib optional for .po files)
- 🐍 Python 3.10+
Roadmap
- Spelling checker (Hunspell integration)
- Word frequency analysis
- Terminology extraction
- Gender-neutral language suggestions
- GitHub Action for CI validation
- LinguaEdit plugin
License
MIT
Author
Daniel Nylander — danielnylander.se
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file svlang-0.1.0.tar.gz.
File metadata
- Download URL: svlang-0.1.0.tar.gz
- Upload date:
- Size: 952.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a949c18d2dac81107554f9276575362e49f0041a9ec5c5b5482e348a43ffcba
|
|
| MD5 |
5fd178e96ebe41f06a71d55aae718395
|
|
| BLAKE2b-256 |
47b947895d43d4e5a30050f97c6ff31686e03ff45ec388fd2befe838cea8322e
|
File details
Details for the file svlang-0.1.0-py3-none-any.whl.
File metadata
- Download URL: svlang-0.1.0-py3-none-any.whl
- Upload date:
- Size: 951.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe07a643a473a9e51b92374570c932eb11ac2af05ba0e1e81296701403b0f4d9
|
|
| MD5 |
9b1d121e92ad1cd5b9438daae51bbaf6
|
|
| BLAKE2b-256 |
e751d9ea5edaf44c7379c7e7653aa24b4b5057e42b1fa646e0f58a7463b3d98e
|