T = wordCloudCounts(str)
tokenizes and preprocesses the text in str for word cloud
creation and returns a table T of words and frequency counts.
The function supports English, Japanese, German, and Korean text.
Extract the text from sonnets.txt using extractFileText.
str = extractFileText("sonnets.txt");
View the first sonnet.
i = strfind(str,"I");
ii = strfind(str,"II");
start = i(1);
fin = ii(1);
extractBetween(str,start,fin-1)
ans =
"I
From fairest creatures we desire increase,
That thereby beauty's rose might never die,
But as the riper should by time decease,
His tender heir might bear his memory:
But thou, contracted to thine own bright eyes,
Feed'st thy light's flame with self-substantial fuel,
Making a famine where abundance lies,
Thy self thy foe, to thy sweet self too cruel:
Thou that art now the world's fresh ornament,
And only herald to the gaudy spring,
Within thine own bud buriest thy content,
And tender churl mak'st waste in niggarding:
Pity the world, or else this glutton be,
To eat the world's due, by the grave and thee.
"
Tokenize and preprocess the sonnets text and create a table of word frequency counts.
Input text, specified as a string array, character vector, or cell array of character vectors.
For string input, the wordcloud
and wordCloudCounts functions use English, Japanese, German, and Korean
tokenization, stop word removal, and word normalization.
Example: ["an example of a short document";"a second short document"]
Table of words counts sorted in order of importance. The table has
columns:
Word
String scalar of the word.
Count
The number of times the word appears in the
documents. The function groups the counts of words that
differ only by case or have a common stem according to
normalizeWords. For example,
the function groups the counts for "walk", "Walking",
"walking", and "walks".
For string input, the wordcloud
and wordCloudCounts functions use English, Japanese, German, and Korean
tokenization, stop word removal, and word normalization.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.