我正在尝试从标记化文档中提取所有名词并选择前 3 个。它不起作用,我怀疑是因为我没有正确使用 strcmp 命令。这是我的代码
sT2 = tokenizedDocument([
"a strongly worded collection of words and letters"
"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,3)