2023-08-12
Split glued or joined words
wordninja package
install wordninja package: pip install wordnija
>>> import wordninja
>>> wordninja.split('bettergood')
['better', 'good']
wordsegment package
install the wordsegment package: pip install wordsegment
.
use programatically:
>>> from wordsegment import load, segment
>>> load()
>>> segment('thisisatest')
['this', 'is', 'a', 'test']
or from CLI
$ echo thisisatest | python -m wordsegment
this is a test
Solutions from: string - How can I split multiple joined words? - Stack Overflow
Tags:
nlp
text-preprocessing
split-text