Skip to main content

🤘 Lemmy

Lemmy is a lemmatizer for Danish 🇩🇰 and Swedish 🇸🇪. It comes ready for use. The Danish model is trained on Dansk Sprognævn's (DSN) word list (‘fuldformliste’) and the Danish Universal Dependencies. The Swedish model is trained on the SALDO's morphology dataset and the Swedish Universal Dependencies (Talbanken). Lemmy also supports training on your own dataset.

The models included in Lemmy were evaluated on the respective Universal Dependencies dev datasets. The Danish model scored > 99% accuracy, while the Swedish model scored > 97%.

You can use Lemmy as a spaCy extension, more specifcally a spaCy pipeline component. This is highly recommended and makes the lemmas easily accessible from the spaCy tokens. Lemmy makes use of POS tags to predict the lemmas. When wired up to the spaCy pipeline, Lemmy has the benefit of using spaCy’s builtin POS tagger.

Lemmy can also by used without spaCy, as a standalone lemmatizer. In that case, you will have to provide the POS tags. Alternatively, you can train a Lemmy model which does not depend on POS tags, though most likely the accuracy will suffer.

Lemmy is heavily inspired by the CST Lemmatizer for Danish.

Install

pip install lemmy

Usage

import da_custom_model as da # name of your spaCy model
import lemmy.pipe
nlp = da.load()

# Create an instance of Lemmy's pipeline component for spaCy.
# Replace 'da' with 'sv' for the Swedish lemmatizer.
pipe = lemmy.pipe.load('da')

# Add the comonent to the spaCy pipeline.
nlp.add_pipe(pipe, after='tagger')

# Lemmas can now be accessed using the `._.lemmas` attribute on the tokens.
nlp("akvariernes")[0]._.lemmas

Training

The notebooks folder contains examples showing how to train your own model using Lemmy.

Metadata

Release files for lemmy 2.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 lemmy 2.0.0
File Size Uploaded
lemmy-2.0.0.tar.gz 628.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lemmy 2.0.0
File Interpreter ABI Platform
lemmy-2.0.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 1.3 MB

Release files / lemmy-2.0.0.tar.gz

Download URL lemmy-2.0.0.tar.gz
Size 628.8 kB
Tags Source
SHA-256 checksum
How to use checksums
63f3500434c5323077353cbf4cc79402c9fcf3e41fc5232f917f1ae46c09a433
BLAKE2b-256 checksum
How to use checksums
aa80a45dac1a79fdd0f833b8725a5dce749bf1388505e946c05ff351775a75cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.5

Release files / lemmy-2.0.0-py2.py3-none-any.whl

Download URL lemmy-2.0.0-py2.py3-none-any.whl
Size 654.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0ec45e8b09bfece6e4677303d46b939f4c9b6b8278975abb6c4ab0fa517923e1
BLAKE2b-256 checksum
How to use checksums
94e5c00c86421c79d8fd64ed0270fd3752a34fea5ebad3a845c119b01a327959
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.5

Release history Release notifications | RSS feed

2.1.0

2 release files

This release

2.0.0 This release

2 release files

1.0.0

2 release files

0.1.0

2 release files

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