Sentiment Analysis Expand Contractions

3 views (last 30 days)
MT_22
MT_22 on 14 Sep 2022
Answered: John D'Errico on 14 Sep 2022
Hello,
I'm currently preprocessing my data for sentiment analysis. In Python there is the possibility to expand contractions (contractions are words or combinations of words that are shortened by dropping letters and replacing them by an apostrophe e.g. change didn't to did not, aren't to are not etc.).
Is this also possible within matlab?
Thanks for your help!

Answers (1)

John D'Errico
John D'Errico on 14 Sep 2022
Is it possible? Of course. Search for the possible contractions. Replace them with uncontracted forms. Note that SOME forms would not be appropriate for replacement. My name, for example. So an automatic scheme would be problematic. But as long as you have a list of valid forms to replace, this is nothing more than a find and replace.
You can use tools like regexp or strfind to locate the contractions that would be replaced. At that point, the replacement would be simple.

Categories

Find more on Install Products in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!