Sentiment Analysis Expand Contractions

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)

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

Asked:

on 14 Sep 2022

Answered:

on 14 Sep 2022

Community Treasure Hunt

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

Start Hunting!