OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Models

ClassifyText (JS)

ClassifyText (JS) is a JavaScript library that trains text classifiers from labeled examples and predicts labels for new text using n-gram features and cosine similarity.

Independent OpenViST project profile, based on linked sources.

ClassifyText (JS) — OpenViST project profile in AI Models.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when you want to add a locally integrated, example-trained text-labeling component to a browser or Node.js project and can provide labeled training samples.

Who it is for

  • JavaScript developers building browser applications that need text labels
  • Node.js developers creating text-classification utilities

Documented uses

  • Train a classifier using sample text grouped by user-defined labels.
  • Predict one or more labels for new text and read the associated confidence values.
  • Serialize a trained model's data for storage and later reuse.
Before you choose

Requirements & limits

  • The documented package installation methods are npm and yarn.
  • The library supports browser and Node.js use and shows both ES module and CommonJS imports.
  • Single-word terms are the default; nGramMin and nGramMax configure the n-gram range.
  • The README describes model serialization for storing training data and reusing it for predictions.
  • The project identifies its license as MIT.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Train a classifier and predict a text label

Install the library, train it with labeled examples, and request predictions for new text.

Before you start

  • A JavaScript project using npm or yarn
  • Text samples grouped under labels to train the classifier

Steps

  1. Install the package with npm install ml-classify-text or yarn add ml-classify-text.

  2. Import Classifier using an ES module or CommonJS import.

  3. Create a Classifier instance and call train with each group of example texts and its label.

  4. Pass new text to predict and inspect the returned labels and confidence values.

Expected outcome

The classifier returns predicted labels, with confidence values when predictions are available.

Guide limitations

  • Predictions depend on the labeled examples used for training.
  • The default representation uses single-word terms; n-gram sizes can be configured when sequences of words matter.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
15 October 2026
Original website title
andreekeberg/ml-classify-text-js · Official homepage title · retained in its source language