Socket
Socket
Sign inDemoInstall

fast-text-win

Package Overview
Dependencies
15
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fast-text-win

Facebook FastText wrapper for Node.js, with tweeks for building on Windows using Visual Studio


Version published
Maintainers
1
Created

Readme

Source

Node.js Fast Text Wrapper

Prediction and nearest neighbour tools from Facebook Fast Text wrapped into Node.js packages.

More here: Facebook Fast Text.

First query takes more time, other queries not :)

Can be built on Windows using Visual Studio.

Prediction

There is a simple class for executing prediction models:

const path = require('path');
const { Classifier } = require('../main');

const model = path.resolve(__dirname, './classification.bin');

const classifier = new Classifier(model);

classifier.predict('how it works', 1, (err, res) => {
    if (err) {
        console.error(err);
    } else if (res.length > 0) {
        const tag = res[0].label; // __label__someTag
        const score = res[0].valuel // 1.3455345
    } else {
        console.log('No matches');
    }
});

Nearest neighbour

There is a simple class for searching nearest neighbours:

const path = require('path');
const { Query } = require('../main');

const model = path.resolve(__dirname, './skipgram.bin');

const query = new Query(model);

query.nn('word', 10, (err, res) => {
    if (err) {
        console.error(err);
    } else if (res.length > 0) {
        const tag = res[0].label;   // letter
        const score = res[0].valuel // 0.99992
    } else {
        console.log('No matches');
    }
});

Keywords

FAQs

Last updated on 04 Apr 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc