RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • addDependencyDetails
    • addEntityDetails
    • addLemmaDetails
    • addPartOfSpeechDetails
    • addSentenceDetails
    • addTypeDetails
    • bagOfNgrams
    • bagOfWords
    • cosineSimilarity
    • doc2sequence
    • encode
    • extractFileText
    • extractHTMLText
    • fastTextWordEmbedding
    • findElement
    • getAttribute
    • htmlTree
    • ind2word
    • isVocabularyWord
    • normalizeWords
    • readWordEmbedding
    • removeLongWords
    • removeShortWords
    • removeStopWords
    • removeWords
    • stopWords
    • tokenDetails
    • tokenizedDocument
    • trainWordEmbedding
    • vaderSentimentScores
    • vec2word
    • word2ind
    • word2vec
    • wordEncoding
    • writeWordEmbedding

removeWords — Remove selected words from tokenized documents or bag-of-words models.

removeWords(documents, words) removes selected tokens from RunMat tokenizedDocument compatibility objects. removeWords(bag, words) removes matching vocabulary columns from RunMat bagOfWords objects. words can also be numeric 1-based vocabulary indices or a logical mask the same length as the object's vocabulary.

Syntax

newDocumentsOrBag = removeWords(documentsOrBag, words)
newDocumentsOrBag = removeWords(documentsOrBag, idx)
newDocumentsOrBag = removeWords(___, 'IgnoreCase', tf)

Inputs

NameTypeRequiredDefaultDescription
documentsOrBagAnyYes—tokenizedDocument or bagOfWords object.
wordsOrIdxAnyYes—Words to remove or indices into the object's Vocabulary.
NameValueAnyVariadic—Name-value options: IgnoreCase.

Returns

NameTypeDescription
newDocumentsOrBagAnyFiltered tokenizedDocument or bagOfWords object.

Errors

IdentifierWhenMessage
RunMat:removeWords:InvalidInputInputs do not match a supported removeWords form.removeWords: invalid input

How removeWords works

  • documents must be a RunMat tokenizedDocument object created by tokenizedDocument.
  • bag must be a RunMat bagOfWords object created by bagOfWords.
  • words can be a string vector, character vector, or cell array of character vectors. A character vector is treated as one word.
  • idx can be a numeric vector of positive integer vocabulary positions from any integer class, or a logical array whose length matches the object's Vocabulary; native positions remain exact through bounds and duplicate checks.
  • removeWords(___, 'IgnoreCase', true) removes string-selected or index-selected vocabulary words without case sensitivity. The default is case-sensitive.
  • For tokenized documents, the result preserves Shape, TokenizeMethod, and Language metadata while recomputing document lengths and vocabulary.
  • For bag-of-words models, the result preserves document row count and removes matching count columns.

GPU memory and residency

removeWords filters host text/model objects and has no provider kernel.

Examples

Remove Words From Documents

documents = tokenizedDocument(["an example of a short sentence"; "a second short sentence"]);
newDocuments = removeWords(documents, ["short" "second"])

Expected output:

`newDocuments` contains `an example of a sentence` and `a sentence`.

Remove Words By Vocabulary Index

documents = tokenizedDocument(["I love MATLAB"; "I love MathWorks"]);
newDocuments = removeWords(documents, [1 3])

Expected output:

`newDocuments` removes the first and third vocabulary entries.

Remove Words From A Bag

documents = tokenizedDocument(["an example of a short sentence"; "a second short sentence"]);
bag = bagOfWords(documents);
newBag = removeWords(bag, stopWords)

Expected output:

`newBag` removes count columns for the selected vocabulary words.

Using removeWords with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how removeWords changes the result.

Run a small removeWords example, explain the result, then change one input and compare the output.

FAQ

Is removeWords case-sensitive?⌄

Yes by default. Use removeWords(___, 'IgnoreCase', true) for case-insensitive matching.

Does a logical index mask need to match the vocabulary length?⌄

Yes. RunMat rejects logical masks whose length differs from the object's vocabulary length.

Does removeWords execute on the GPU?⌄

No. It filters host text/model metadata and has no runmat-accelerate provider path.

Related Strings functions

Text Analytics

addDependencyDetails · addEntityDetails · addLemmaDetails · addPartOfSpeechDetails · addSentenceDetails · addTypeDetails · bagOfNgrams · bagOfWords · cosineSimilarity · doc2sequence · encode · extractFileText · extractHTMLText · fastTextWordEmbedding · findElement · getAttribute · htmlTree · ind2word · isVocabularyWord · normalizeWords · readWordEmbedding · removeLongWords · removeShortWords · removeStopWords · stopWords · tokenDetails · tokenizedDocument · trainWordEmbedding · vaderSentimentScores · vec2word · word2ind · word2vec · wordEncoding · writeWordEmbedding

Transform

append · deblank · erase · eraseBetween · erasePunctuation · eraseURLs · extractAfter · extractBefore · extractBetween · insertAfter · insertBefore · join · lower · pad · replace · replaceBetween · reverse · split · splitlines · strcat · strip · strjoin · strjust · strrep · strsplit · strtrim · upper

Core

blanks · char · compose · convertCharsToStrings · convertContainedStringsToChars · convertStringsToChars · genvarname · int2str · isletter · isspace · isStringScalar · isstrprop · mat2str · native2unicode · newline · num2str · sprintf · sscanf · str2double · str2num · strcmp · strcmpi · string · string.empty · strings · strlength · strncmp · strncmpi · strtok · unicode2native

Search

contains · endsWith · matches · startsWith · strfind

Pattern

digitsPattern · lettersPattern · pattern · regexpPattern · textBoundary · wildcardPattern

Regex

regexp · regexpi · regexprep

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how removeWords is executed, line by line, in Rust.

  • View the source for removeWords in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How removeWords works
  • GPU memory and residency
  • Examples
  • Remove Words From Documents
  • Remove Words By Vocabulary Index
  • Remove Words From A Bag
  • Using removeWords with coding agents
  • FAQ
  • Related Strings functions
  • Text Analytics
  • Transform
  • Core
  • Search
  • Pattern
  • Regex
  • Open-source implementation
  • About RunMat