Skip to main content

pytestpythonCode style: blackPyPI version

split-words

CharSplit repacked with poetry, published as pypi split-words-- all credit goes to the original author.

pip install split-words
# replace charsplit with split_words in the following, e.g.
from split_words import Splitter
...

CharSplit - An ngram-based compound splitter for German

url

Splits a German compound into its body and head, e.g.

Autobahnraststätte -> Autobahn - Raststätte

Implementation of the method decribed in the appendix of the thesis:

Tuggener, Don (2016). Incremental Coreference Resolution for German. University of Zurich, Faculty of Arts.

TL;DR: The method calculates probabilities of ngrams occurring at the beginning, end and in the middle of words and identifies the most likely position for a split.

The method achieves ~95% accuracy for head detection on the Germanet compound test set.

A model is provided, trained on 1 Mio. German nouns from Wikipedia.

Usage

Train a new model:

training.py --input_file --output_file

from command line, where input_file contains one word (noun) per line and output_file is a json file with computed n-gram probabilities.

Compound splitting

In python

>> from charsplit import Splitter
>> splitter = Splitter()
>> splitter.split_compound("Autobahnraststätte")

returns a list of all possible splits, ranked by their score, e.g.

[(0.7945872450631273, 'Autobahn', 'Raststätte'),
(-0.7143290887876655, 'Auto', 'Bahnraststätte'),
(-1.1132332878581173, 'Autobahnrast', 'Stätte'), ...]

By default, Splitter uses the data from the file charsplit/ngram_probs.json. If you retrained the model, you may specify a custom file with

>> splitter = Splitter(ngram_path=<json_data_file_with_ngram_probs>)

Metadata

Release files for split-words 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for split-words 0.1.3
File Size Uploaded
split_words-0.1.3.tar.gz 12.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for split-words 0.1.3
File Interpreter ABI Platform
split_words-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 26.3 MB

Release files / split_words-0.1.3.tar.gz

Download URL split_words-0.1.3.tar.gz
Size 12.9 MB
Tags Source
SHA-256 checksum
How to use checksums
7dbb69a85a722355c32de8520fe4d083aa9b4020cbe2cb44175758260fdadeb0
BLAKE2b-256 checksum
How to use checksums
6a28f9c3c5e886b9e2a0088e50c0f87c3080b345be46bc7bf540e18ae5ab0e94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.10 Windows/10

Release files / split_words-0.1.3-py3-none-any.whl

Download URL split_words-0.1.3-py3-none-any.whl
Size 13.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2bd73849a7786a2a1892d87a2cde2ecf78b69bcdc9146a2f38680e74d3908274
BLAKE2b-256 checksum
How to use checksums
0066c753381236dd46ccecb423292ae16e44768588ac922093868291080448c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.10 Windows/10

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

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