T.NumOccurrences = numOccurrences;
T.PercentOfText = numOccurrences / numWords * 100.0;
T.CumulativePercentOfText = cumsum(numOccurrences) / numWords * 100.0;
Display the statistics for the ten most common words.
T(1:10,:)
ans=10×4 table
Words
NumOccurrences
PercentOfText
CumulativePercentOfText
______
______________
_____________
_______________________
"and"
490
2.7666
2.7666
"the"
436
2.4617
5.2284
"to"
409
2.3093
7.5377
"my"
371
2.0947
9.6324
"of"
370
2.0891
11.722
"i"
341
1.9254
13.647
"in"
321
1.8124
15.459
"that"
320
1.8068
17.266
"thy"
280
1.5809
18.847
"thou"
233
1.3156
20.163
The most common word in the Sonnets, and, occurs 490 times. Together, the ten most common words
account for 20.163% of the text.
See Also
string | split | join | unique | replace | lower | splitlines | histcounts | strip | sort |
table
Related Examples
•
“Create String Arrays” on page 6-5
•
“Search and Replace Text” on page 6-37
•
“Compare Text” on page 6-32
•
“Test for Empty Strings and Missing Values” on page 6-20
Analyze Text Data with String Arrays
6-19
Précédent

- 201/1450

Suivant