채택된 답변

Walter Roberson
Walter Roberson 2012년 5월 29일

1 개 추천

The first thing you need to do is to figure out what is or is not a "word" for your purposes. Contractions, possessives, hyphenation, abbreviations, acronyms, numbers.... ?
Is a capitalized word to be considered the same as a lower-case word? For example, "How" compared to "how" ?
Is a word in all-capitals to be considered the same as a lower-case word? For example, if you have an article about taking your house-hold "pet" to a "PET" scan, then are "pet" and "PET" the same word or different words?

댓글 수: 1

reyhane
reyhane 2012년 5월 29일
yes they r same word,but actually i can be happy,if the programme can say frequent word even all wordswere writter as a lower-case word

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 5월 29일

0 개 추천

Something like:
str = 'See Spot run, see Spot jump, see Spot eat';
C = regexp(lower(str),' ','split')';
[val,idxC, idxV] = unique(C);
n = accumarray(idxV,1);
[n idxC] %n occurences for word C(idxC)
obviously this needs to be augmented to take into account punctuation, whether you want to account for caps etc.

댓글 수: 1

reyhane
reyhane 2012년 5월 29일
thank u so much :) I have to check it out

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Language Support에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by