I’m trying to extract all the nouns from a tokenized document and select the top 100. It’s not working, I suspect because I am not using the strcmp command correctly. This is my code
sT2 = tokenizedDocument([
"a strongly worded collection of words"
"another collection of words"]);
tD = tokenizedDocument(sT2);
tD = addPartOfSpeechDetails(tD);
tdetails = tokenDetails(tD);
td7 = table2cell(tdetails(:,7)); % PARTS OF SPEECH
siztd7 = size(td7);
cc = 1;
for ii = 1:siztd7
if strcmp(td7(ii,1), noun') == 1
tDNoun(cc) = tdetails(1,:);
cc = cc + 1;
end
end
bag = bagOfWords(tDNoun);
tb100 = topkwords(bag,100)