Remove stop words from a cell array
显示 更早的评论
I am trying to remove german stop-words from a cell array. Below is the respective code:
if removeStopWords == 1
stop_words = cellstr(stopWords('Language','de'));
split1 = regexp(chatM, '\s','Split');
split1 = cellfun(@(x)strjoin(x), split1, 'Uni', 0);
split1 = cellfun(@(x)convertStringsToChars(x), split1, 'Uni', 0);
chatM = strjoin(split1(~ismember(split1, stop_words)), ' ');
end
I applied a solution from a simillar question on the forum, but it did not work for me properly and I do not understand why.
The problem is, that it removes patterns and not words: imagine you want to remove "Ok" from "Ok Okay OOk". The result will be "ay O", but I want to get "Okay OOk".
By the way, I also tried removeStopWords(str), but the result was the same. In the end I want to count the occurrence of "relevant" words, so I need to remove stop words at first.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Language Support 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!