Skip to main content

Hannover Tagger: Morphological Analysis and POS Tagging

Reason this release was yanked:

Wrong license

Project description

HanTa - The Hanover Tagger

HanTa is a pure Python package for lemmatization and POS tagging of Dutch, English and German sentences. The approach is to some extent language indpendent and language models for more langauges will be added in future.

Lemmatization and POS tagging are based on the morphological analysis of a word. The morphological analysis is done by an Hidden Markov Model that tries to find the best sequence of morphemes underlying each word.

Usage

First a model has to be loaded:

from HanTa import HanoverTagger as ht

tagger_de = ht.HanoverTagger('morphmodel_ger.pgz')
tagger_nl = ht.HanoverTagger('morphmodel_dutch.pgz')
tagger_en = ht.HanoverTagger('morphmodel_en.pgz')

Now we have three methods to anaylze words and sentences:

tagger_en.tag_word('eating')

will give a list of all possible parts of speech (PoS) for the word eating together with a probability score.

tagger_en.tag_word('eating')

The function analyze gives the most likely PoS and the lemma (VBG and eat in the exmaple below).

tagger_en.analyze('unhappiest')

Using various optional parameters we can get more information like e.g. a list of morphemes:

tagger_nl.analyze('huishoudhulpje',taglevel=3)

The last call producses the following output:

('huishoudhulp', [('huis', 'N(soort,onz)'), ('houd', 'WW'), ('hulp', 'N(soort,zijd)'), ('je', 'SUF_DIM')], 'N(soort,ev,dim,onz,stan)')

The package also contains a simple trigram based PoS tagger, that uses the probabilities from the morphological analysis for unknown words (and infrequent words from he training data).

import nltk
from pprint import pprint

sent = "Die Europawahl in den Niederlanden findet immer donnerstags statt."

words = nltk.word_tokenize(sent)
lemmata = tagger_de.tag_sent(words)
pprint(lemmata)

Further reading

For more information refer to the following resources:

  • The main documentation: The Hanover Tagger (Version 1.1.0) - Lemmatization, Morphological Analysis and POS Tagging in Python. Hannover, 2023 Online Available
  • Demo.ipynb on GitHub (https://github.com/wartaal/HanTa)
  • Original publication: Christian Wartena. A probabilistic morphology model for German lemmatization. In Proceedings of the 15th Conference on Natural Language Processing (KONVENS 2019): Long Papers, pages 40–49, Erlangen, Germany, 2019. German Society for Computational Linguistics & Language Technology. Online Available

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hanta-1.2.0.tar.gz (14.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hanta-1.2.0-py3-none-any.whl (14.2 MB view details)

Uploaded Python 3

File details

Details for the file hanta-1.2.0.tar.gz.

File metadata

  • Download URL: hanta-1.2.0.tar.gz
  • Upload date:
  • Size: 14.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for hanta-1.2.0.tar.gz
Algorithm Hash digest
SHA256 eb0ea6c4cc0da8a3dd852038c2f5214d715c7d0f77ecd89cf5e82b6dc3fca957
MD5 d69668e50048c324ee187e7962e629af
BLAKE2b-256 41fae0708d58e44d9b4bb76a951ae4ae3f798f14ff87f7c8a8c81c26c8011449

See more details on using hashes here.

File details

Details for the file hanta-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: hanta-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for hanta-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aad4fdd1eff50522f2b4c2d5c87752beb5bd266c53161bffdda9dc7ca269a476
MD5 bae7aaafb5bf06641f52639b3a33e275
BLAKE2b-256 a2b370a1b4e24cb15b42b58ed73737306afb8ff1ebfc7fe88d194d51ffcb9463

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page