Filter löschen
Filter löschen

How to select only ADJECTIVES from a list of strings?

2 Ansichten (letzte 30 Tage)
Salad Box
Salad Box am 10 Sep. 2020
Kommentiert: Salad Box am 10 Sep. 2020
Hi
I have a list of words in the string format. See below
I would like to only select adjectives from this list.
How to achieve it? Please help.:)
  4 Kommentare
Salad Box
Salad Box am 10 Sep. 2020
I'm not sure whether you understand my question, or did I not make my question clear? Let me know please.
Matt J
Matt J am 10 Sep. 2020
Bearbeitet: Matt J am 10 Sep. 2020
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"?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Matt J
Matt J am 10 Sep. 2020
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
  1 Kommentar
Salad Box
Salad Box am 10 Sep. 2020
No I don't have a list of adjectives to cross check against.
Without this, how to do it?
I'm thinking of using part-of-speech function. Then how to select those words tagged 'adjectives' as part-of-speech?
For instance,
if the 2nd, the 4th, and the 10th word in a list of words are tagged as 'adjectives' as part-of-speech, how to know the indices of those words are 2, 4 and 10?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by