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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.