RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

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.

/
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

tokenizedDocument — Create tokenized document objects for Text Analytics workflows.

tokenizedDocument(str) tokenizes English or German text into a tokenizedDocument object. It also accepts pre-tokenized words with TokenizeMethod, "none", plus custom-token and regular-expression tokenization tables.

Syntax

documents = tokenizedDocument
documents = tokenizedDocument(str)
documents = tokenizedDocument(str, Name, Value, ...)

Inputs

str
Type
Any
Required
Yes
Description
Input text or pre-tokenized words.
NameValue
Type
Any
Required
Variadic
Description
Name-value options: TokenizeMethod, Language, DetectPatterns, TopLevelDomains, CustomTokens, RegularExpressions.
NameTypeRequiredDefaultDescription
strAnyYes—Input text or pre-tokenized words.
NameValueAnyVariadic—Name-value options: TokenizeMethod, Language, DetectPatterns, TopLevelDomains, CustomTokens, RegularExpressions.

Returns

documents
Type
Any
Description
Tokenized document object.
NameTypeDescription
documentsAnyTokenized document object.

Errors

RunMat:textAnalyticsDocuments:InvalidInput
When
Inputs do not match a supported Text Analytics document or model helper form.
Message
Text Analytics document helper received invalid input
RunMat:tokenizedDocument:TooManyOutputs
When
The requested output count exceeds the canonical signatures.
Message
tokenizedDocument: too many output arguments
IdentifierWhenMessage
RunMat:textAnalyticsDocuments:InvalidInputInputs do not match a supported Text Analytics document or model helper form.Text Analytics document helper received invalid input
RunMat:tokenizedDocument:TooManyOutputsThe requested output count exceeds the canonical signatures.tokenizedDocument: too many output arguments

Supported forms

documents = tokenizedDocument

documents = tokenizedDocument(str)

documents = tokenizedDocument(str, 'TokenizeMethod', method)

documents = tokenizedDocument(str, 'Language', language)

documents = tokenizedDocument(str, 'DetectPatterns', patterns)

documents = tokenizedDocument(str, 'TopLevelDomains', domains)

documents = tokenizedDocument(str, 'CustomTokens', tokens)

documents = tokenizedDocument(str, 'RegularExpressions', patterns)

documents is a tokenizedDocument object.

method must be "unicode" or "none".

language must currently be "en" or "de".

patterns may be "all", "none", or a text vector containing supported complex-token pattern names.

domains may be a character vector, string array, or cell array of character vectors containing top-level-domain labels.

tokens may be a text vector or table with Token and optional Type variables.

RegularExpressions patterns may be a text vector or table with Pattern and optional Type variables.

Behavior

tokenizedDocument with no input creates a scalar object containing one empty document.

str may be a string scalar, string array, character vector, multi-row character array, or cell array of scalar text.

String arrays and cell arrays preserve their document-array shape in the object's Shape property. Character matrices are treated as one document per row.

tokenizedDocument(str, 'TokenizeMethod', 'unicode') tokenizes text into words and simple punctuation tokens.

tokenizedDocument(words, 'TokenizeMethod', 'none') accepts a string array, character vector, or cell form as pre-tokenized words. A cell array of string arrays represents multiple pre-tokenized documents.

Language currently accepts "en" or "de". Japanese, Korean, and MeCab tokenization are not implemented.

DetectPatterns accepts "all", "none", or a string/cell vector containing one or more of "email-address", "web-address", "hashtag", "at-mention", and "emoticon". RunMat only keeps enabled complex patterns as single tokens.

TopLevelDomains accepts a character vector, string array, or cell array of character vectors and controls web-address recognition when DetectPatterns includes "web-address". RunMat stores normalized TLD labels and uses custom lists for bare domains, www. addresses, and http:///https:// addresses; with the default list, explicit www. and scheme URLs are accepted when the host has a valid domain shape.

CustomTokens accepts a character vector, string scalar/vector, cell text vector, or table with a required Token variable and optional Type variable. Custom tokens are kept as single tokens, conflicting matches use the longest token, and missing or empty table Type values default to "custom".

RegularExpressions accepts a character vector, string scalar/vector, cell text vector, or table with a required Pattern variable and optional Type variable. Patterns are matched at the current tokenizer position, invalid or empty-matching patterns are rejected, conflicting regular-expression matches use the last matching pattern, and regular-expression tokens take precedence over custom tokens.

The returned object stores Vocabulary, Documents, NumDocuments, DocumentLengths, Shape, TokenizeMethod, Language, DetectPatterns, and TopLevelDomains. Custom-token and regular-expression calls also store TypeDetails for tokenDetails.

A document array is represented by one scalar object carrying document cells and Shape metadata. First-class object-array identity is not yet available for this class.

Native numeric arrays are not document text or valid option values and are rejected before provider access. Document counts and lengths are stored as generated double metadata.

Execution and residency

tokenizedDocument tokenizes host-resident text and stores text metadata; it does not use provider kernels.

tokenizedDocument tokenizes host-resident text and has no provider kernel.

Implementation boundary

RunMat uses its existing host tokenizer and compatibility-object representation, not the complete MATLAB language-analysis engine. Tokenization and custom/regular-expression rules are evaluated on host text; no numeric GPU kernel or fusion path is available.

Finite host allocation

The current implementation requires an Unbounded host allocation policy. Under Managed finite allocation, a shared family guard rejects before gather, model cloning, mutation or filesystem work because complete text-model scratch and metadata ownership is not yet implemented. Authority is checked again after suspension and before publication, and failures are terminal rather than permission to replay. This refusal is an implementation frontier, not completion of finite resource support.

Examples

Tokenize Text

documents = tokenizedDocument(["A short document"; "Another document"])

Expected output:

`documents.NumDocuments` is `2`, and `documents.Vocabulary` contains the unique tokens in first-seen order.

Use Pre-Tokenized Words

documents = tokenizedDocument(["alpha" "beta" "alpha"], "TokenizeMethod", "none")

Expected output:

`documents.DocumentLengths` is `3` for the single pre-tokenized document.

Choose Complex Token Patterns

documents = tokenizedDocument("Mail a@example.com #MATLAB at https://example.com", "DetectPatterns", ["email-address" "hashtag"])

Expected output:

The email address and hashtag stay as single tokens; the web address is tokenized as ordinary text and punctuation.

Configure Web Address Domains

documents = tokenizedDocument("See example.zz", "TopLevelDomains", "zz")

Expected output:

`example.zz` is recognized as a web-address token.

Use Custom Token Types

rules = table(["Na+"; "H2O"], ["ion"; "formula"], 'VariableNames', ["Token" "Type"])
documents = tokenizedDocument("Na+ in H2O", "CustomTokens", rules)

Expected output:

`Na+` and `H2O` stay as single tokens, and `tokenDetails(documents)` reports `ion` and `formula` type labels for those tokens.

Use Regular Expression Tokens

patterns = table(["[a-z]+\\d+"; "abc\\d+"], ["alnum"; "code"], 'VariableNames', ["Pattern" "Type"])
documents = tokenizedDocument("abc123 xyz9", "RegularExpressions", patterns)

Expected output:

`abc123` and `xyz9` stay as single tokens. The later matching `abc\\d+` pattern supplies the `code` type for `abc123`.

Using tokenizedDocument with coding agents

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

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

FAQ

Is RunMat's tokenizedDocument a full MATLAB object array?⌄

No. It is one scalar object with document cells and a Shape property; first-class object-array identity is not yet available for this class.

Does tokenizedDocument support Japanese or Korean tokenization?⌄

No. Japanese, Korean, and MeCab tokenization forms currently raise an unsupported-input error.

Does tokenizedDocument execute on the GPU?⌄

No. Tokenization is host text processing and has no runmat-accelerate provider path.

Does RunMat ship the full MathWorks topLevelDomains list?⌄

Not yet. RunMat supports user-specified TopLevelDomains, a compact built-in default list for common bare domains, and permissive default handling for explicit www./scheme URLs; full default corpus parity remains tracked.

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 · removeWords · stopWords · tokenDetails · 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

Source you can read

Every RunMat function's source is public. Read exactly how tokenizedDocument is executed, line by line, in Rust.

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

About RunMat

RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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
  • Supported forms
  • Behavior
  • Execution and residency
  • Implementation boundary
  • Finite host allocation
  • Examples
  • Tokenize Text
  • Use Pre-Tokenized Words
  • Choose Complex Token Patterns
  • Configure Web Address Domains
  • Use Custom Token Types
  • Use Regular Expression Tokens
  • Using tokenizedDocument with coding agents
  • FAQ
  • Related Strings functions
  • Text Analytics
  • Transform
  • Core
  • Search
  • Pattern
  • Regex
  • Source you can read
  • About RunMat