+ 3
Apostrophe removal
I want to remove apostrophes in all verbs and change it to normal format in python. What is the best way whether regex pattern or any packages to do it? For eg. didn't > did not, I'm > I am
4 Antworten
+ 10
A valid approach for this might be to map common words to their replacements
https://stackoverflow.com/questions/43018030/replace-apostrophe-short-words-in-JUMP_LINK__&&__python__&&__JUMP_LINK
https://stackoverflow.com/questions/19790188/expanding-english-language-contractions-in-python
and apparently there's (there is ^_^) a package as well
https://pypi.org/project/pycontractions/
+ 6
This is actually a lot more complicated than it looks like because you have to consider that people use all kinds of different apostrophes (', ', `), lower and capital letters etc. Probably regex would be the most efficient method. However, here's a code that does everything manually (and still isn't case sensitive):
https://code.sololearn.com/cFv7sq6t9ba2/?ref=app
/Edit: "ain't" can also be "isn't" , right? 🤔
+ 3
That's a tricky problem because:
didn't => did not -> dn' => {d no}
I'm => I am ->' => { a}
So I think a case-by-case basis is better.
+ 1
I think you want to do something like this:
https://code.sololearn.com/cEtLpX01MlA3/?ref=app