Wordninja is a Python library that probabilistically splits concatenated words based on English Wikipedia uni-gram frequencies. It is designed to segment strings like 'imateapot' into ['im', 'a', 'teapot']. The current version is 2.0.0, released in August 2019, with a focus on stability rather than active new feature development.
pip install wordninjaVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import the library and use the `split` function to segment a concatenated string into a list of words.
To preserve punctuation, you may need to pre-process the text, or consider using the `wordninja-enhanced` fork (e.g., `pip install wordninja-enhanced`) which includes punctuation preservation and other features not present in the original library.
For critical applications, consider reviewing results for specific edge cases or exploring custom language models. The library supports custom language models if provided as gzipped text files with one word per line in decreasing order of probability.
If working with non-English languages or specific domains, ensure your custom word list adheres strictly to the required format. The `wordninja-enhanced` fork offers out-of-the-box support for several additional languages.
Install the library using pip: `pip install wordninja`
Reinstall wordninja using `pip install --force-reinstall wordninja` or ensure proper file permissions for the package installation directory.
Ensure the argument passed to `wordninja.split()` is a string, for example: `wordninja.split('exampletext')`Use `import wordninja` to import the library, and then call functions like `wordninja.split()`.
No dependency data recorded yet.