npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@optimaxer/web-classifier

v1.3.6

Published

Welcome to **@optimaxer/web-classifier**, a powerful JavaScript library designed for natural language text classification. Whether you are building a customer feedback analysis tool, a sentiment analysis application, or any other system that requires text

Downloads

202

Readme

@optimaxer/web-classifier

Welcome to @optimaxer/web-classifier, a powerful JavaScript library designed for natural language text classification. Whether you are building a customer feedback analysis tool, a sentiment analysis application, or any other system that requires text categorization, this library provides a robust and efficient solution to meet your needs.

@optimaxer/web-classifier leverages state-of-the-art language models and embedding techniques to classify user texts into predefined categories. A key feature of this library is that the small language model is loaded and executed directly on the end user's device. This approach not only saves on computational resource costs but also enhances data privacy by keeping user data local.

Overview

@optimaxer/web-classifier provides a comprehensive suite of tools for classifying natural language texts. It is built with flexibility and usability in mind, offering components that are straightforward to use while providing powerful classification capabilities.

Components

  • Classifier: The core component of the library, responsible for setting up and executing text classification. It supports initializing with a variety of models and embedding engines to best fit your application's needs.

How It Works

The library operates in two main stages:

  • Setup: Initialize the classifier by configuring the necessary components, including selecting the language model and embedding engine. The small language model will be loaded and run on the end user's device, which helps save on computational costs and keeps user data private. This step ensures that the classifier is properly prepared for processing texts.
  • Classify: Once set up, you can use the classifier to categorize texts into predefined categories. The classification process involves analyzing the text and applying machine learning models to determine the appropriate category.

Due to the restrictions of the Firefox browser, these libraries and functionalities may not work well on Firefox. Please note this limitation.

Quickstart

Getting Started with web-classifier Library

Getting started with the web-classifier library is straightforward. Follow these steps to integrate and utilize the library in your web application effectively.

Step 1: Install the Library

To begin using @optimaxer/web-classifier, you'll first need to install it in your project. You can do this using npm. Open your terminal and run the following command:

npm install @optimaxer/web-classifier

This command will add the library to your project's dependencies.

Step 2: Setting Up the Classifier

Once the library is installed, you need to set up the Classifier component. This step involves initializing the classifier with the appropriate configurations, including the Small Language Model and Browser Embedding Engine.

Here’s how to do it:

  1. Import the Classifier component:

    import { Classifier } from '@optimaxer/web-classifier';
  2. Configure the Classifier:

    You need to specify the model and engine for the classifier. For example, if you are using 'gemma' as your model and 'mediapipe' as your embedding engine, you can set it up like this:

    const classifier = await classifier.setup({
        model: 'gemma',
        inferenceEngine: 'mediapipe',
        mode: 'local'
    });

Step 3: Classifying Texts

With the classifier set up, you can now classify user texts into predefined categories. The classify method allows you to categorize texts based on the configured classifier.

Here’s an example:

const sentiment = await classifier.classify('I absolutely love this product!', 'sentiment', ['positive', 'negative']);

The classify method will return the classification result based on the specified categories.

You need to specify the text to classify, the type of classification (e.g., 'sentiment', 'general'), and the categories you want to classify into (e.g., 'positive' and 'negative').