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.3.tar.gz (17.2 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.3-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wortsalat-0.0.3.tar.gz
  • Upload date:
  • Size: 17.2 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.3.tar.gz
Algorithm Hash digest
SHA256 a7d6905311cf2f5de88271b80eecd8b7f91f2ae26817faaff5970c377221253e
MD5 46c0adf4ff91f69400a73363ed73869b
BLAKE2b-256 7f70445a4d607e5e24eb1aa9c06593fbb313ffda8a8e6977350276f0b39987b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wortsalat-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c79e6969c4cf6b8169d0dca4d6617c2420d9e5bbd46a0c1e68b00f0fa7f30c6e
MD5 6fbcbc5d08624c4990e3c05c5d7b8f49
BLAKE2b-256 36892ae35dc34dbb9a82b815d813bb3a7f5229428863467ff149c0e1c739edc4

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