How to select only ADJECTIVES from a list of strings?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi
I have a list of words in the string format. See below
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/358813/image.png)
I would like to only select adjectives from this list.
How to achieve it? Please help.:)
4 件のコメント
回答 (1 件)
Matt J
2020 年 9 月 10 日
Do you have a list of adjectives to cross check against? And what if a word is both an adjective and a noun, like "orange"? If you just want to know if a word belongs to another list containing exclusively adjectives, you can use ismember, e.g.,
>> adjectives={'red','three','passive','candid'};
>> s=["red","person","woman","man","camera","tv","three"]
>> ismember(s,adjectives)
ans =
1×7 logical array
1 0 0 0 0 0 1
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!