'remove hastag and keep word in python
I want to remove hastag but still keep the words in that hastag. for example :
#ihateyousomuch
the output that i want is 'I hate you so much'
I try many code but doesnt work and the output is "ihateyousomuch"
Solution 1:[1]
Possible solution is to use the wordninja library. This library is not 100% accurate but helps in such cases.
#pip install wordninja
import wordninja
string = '#ihateyousomuch'
result = " ".join(wordninja.split(string.replace('#', '')))
print(result)
Prints
i hate you so much
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | gremur |
