Registry / ai-ml / wordsegment

wordsegment

JSON →
library1.3.1pypypi✓ verified 86d ago

English word segmentation library that segments concatenated text into separate words. Version 1.3.1 released October 2019; no active development since then. Designed for segmenting hashtags, URLs, or other concatenated phrases.

pip install wordsegment
INSTALL
IMPORT
SIG · WORDSEGMENT
W
wordsegment
ai-mlpythonv1.3.1
Install
1.7s avg
Import
Disk
28MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 29.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 30MB
28MB installed
● package 28MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

segment
from wordsegment import segment
Correct import path.

Basic segmentation example using the default model.

from wordsegment import segment print(segment('wheninthecourse')) # Output: ['when', 'in', 'the', 'course']
Debug
Known issues
gotchaThe library uses a unigram model that may not handle proper nouns or domain-specific terms well. It can produce unexpected segmentations for text with numbers or mixed case.
fix
Preprocess input to lowercase or clean punctuation. Consider adding custom words to the model.
affects: all
deprecatedThis library is no longer actively maintained. Python 2 support may have issues; Python 3 is recommended.
fix
Consider using an alternative like 'wordninja' or a more modern NLP library.
affects: <=1.3.1
gotchaThe 'segment' function expects a single string without spaces. Passing a string with spaces will still segment but may produce incorrect results.
fix
Remove spaces or punctuation from input before passing to segment.
affects: all
Errors
Common errors & fixes
ImportError: No module named 'wordsegment'
The library is not installed or the environment is wrong.
fix
Run 'pip install wordsegment' in the correct Python environment.
TypeError: segment() missing 1 required positional argument: 'text'
Calling segment without arguments or passing keyword incorrectly.
fix
Use segment('yourtext') with a single string argument.
Upgrade
Version history
1.3.1latest on PyPI · released Jul 7, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
44 hits · last 30 days
node
38
OpenAI (training)
1
Resources
wordsegment — pip install wordsegment · libregistry