Skip to main content

An NLP python library for analyzing the german language.

Project description

Wortsalat

Wortsalat is a Python library that provides various linguistic analysis tools for text data. It includes functions for tokenizing text into words and sentences, identifying words that match specific word lists or POS tags, counting the total number of words and sentences, calculating the average word length and words per sentence, and calculating various readability scores.

Installation

You can install Wortsalat from PyPI:

pip install wortsalat

Usage

Here are some examples of how to use the functions provided by Wortsalat:

Tokenize Text into Words

from wortsalat.preprocess import tokenize_words

text = "Dies ist ein Beispieltext."
words = tokenize_words(text)
print(words)

This will output: ['Dies', 'ist', 'ein', 'Beispieltext', '.']

Split Text into Sentences

from wortsalat.preprocess import split_sentences

text = "Dies ist ein Beispieltext. Hier ist eine weitere Satz."
sentences = split_sentences(text)
print(sentences)

This will output: ['Dies ist ein Beispieltext.', 'Hier ist eine weitere Satz.']

Identify Words That Match a Specific Word List

from wortsalat.identify_words import identify_words

text = "Dies ist ein Beispieltext. Hier ist eine weitere Satz."
words = identify_words(['Dies', 'ist', 'ein'], text)
print(words)

This will output: ['Dies', 'ist', 'ein']

Identify Words That Match a Specific POS Tag

from wortsalat.identify_tags import identify_tags

text = "Dies ist ein Beispieltext. Hier ist eine weitere Satz."
words = identify_tags('ART', text)
print(words)

This will output: ['Dies', 'ein']

Count the Total Number of Words

from wortsalat.count import count_total_words

text = "Dies ist ein Beispieltext. Hier ist eine weitere Satz."
num_total_words = count_total_words(text)
print(num_total_words)

This will output: 6

Calculate the Flesch Reading Ease Score

from wortsalat.wrapper import calculate_flesch_score

text = "Dies ist ein Beispieltext. Hier ist eine weitere Satz."
flesch_score = calculate_flesch_score(text)
print(flesch_score)

This will output the Flesch reading ease score of the text.

References

Contributing - It takes a village!

If you find a bug or have a feature request, please open an issue on GitHub. If you want to contribute to the development of Wortsalat, please fork the repository, make your changes, and then open a pull request.

Additional thanks to:

License

Wortsalat is released under the Apache 2.0 License.

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

wortsalat-0.0.4.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

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

wortsalat-0.0.4-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file wortsalat-0.0.4.tar.gz.

File metadata

  • Download URL: wortsalat-0.0.4.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for wortsalat-0.0.4.tar.gz
Algorithm Hash digest
SHA256 16e924174361f236c90f0be4e9b1714c58e8f8f1b80c8e8650c27063ddf3f80a
MD5 73229c7fdd135e7751edffa76f6172e8
BLAKE2b-256 068c0c5dbb80c0aa4d9652648ead29fa3b590e504c84ebe7564ca0d44da4e02f

See more details on using hashes here.

File details

Details for the file wortsalat-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: wortsalat-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for wortsalat-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4a53d18724461b44557beb0d17159cc1984ae821f456393df2243defb8f76eb0
MD5 8915e13e0c38fc320211d23870edfc4f
BLAKE2b-256 d8c0a34e364945cc0384d56a1682bcebda5e74a644da9d27183c54abaf3cdb89

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