newBag = removeInfrequentWords(bag,count)
removes the words that appear at most count times in total from
the bag-of-words model bag. The function, by default, is case
sensitive.
newBag = removeInfrequentWords(bag,count,'IgnoreCase',true)
removes the words that appear at most count times in total
ignoring case. If words differ only by case, then the corresponding counts are
merged.
Remove the words that appear two times or fewer from a bag-of-words model.
Create a bag-of-words model from an array of tokenized documents.
documents = tokenizedDocument([
"an example of a short sentence""a second short sentence""another example""a short example"]);
bag = bagOfWords(documents)
bag =
bagOfWords with properties:
NumWords: 8
Counts: [4×8 double]
Vocabulary: ["an" "example" "of" "a" "short" "sentence" "second" "another"]
NumDocuments: 4
Remove the words that appear two times or fewer from the bag-of-words model.
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.