
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
Nodejs binding for fasttext representation and classification.
This is a link to the Facebook fastText. A Library for efficient text classification and representation learning.
Using npm:
npm install fasttext --save
According to fasttext.cc. We have a simple classifier for executing prediction models about cooking from stackexchange questions:
const path = require('path');
const fastText = require('fasttext');
const model = path.resolve(__dirname, './model_cooking.bin');
const classifier = new fastText.Classifier(model);
classifier.predict('Why not put knives in the dishwasher?', 5, (err, res) => {
if (err) {
console.error(err);
} else if (res.length > 0) {
let tag = res[0].label; // __label__knives
let confidence = res[0].value // 0.8787146210670471
console.log('classify', tag, confidence, res);
} else {
console.log('No matches');
}
});
Before we haved trained model to use the followings params:
# Training
~/fastText/data$ ./fasttext supervised -input cooking.train -output model_cooking -lr 1.0 -epoch 25 -wordNgrams 2 -bucket 200000 -dim 50 -loss hs
Read 0M words
Number of words: 8952
Number of labels: 735
Progress: 100.0% words/sec/thread: 1687554 lr: 0.000000 loss: 5.247591 eta: 0h0m 4m
# Testing
~/fastText/data$ ./fasttext test model_cooking.bin cooking.valid
N 3000
P@1 0.587
R@1 0.254
Number of examples: 3000
Simple class for searching nearest neighbors:
const path = require('path');
const fastText = require('fasttext');
const model = path.resolve(__dirname, './skipgram.bin');
const query = new fastText.Query(model);
query.nn('word', 5, (err, res) => {
if (err) {
console.error(err);
} else if (res.length > 0) {
let tag = res[0].label; // letter
let confidence = res[0].value // 0.99992
console.log('Nearest neighbor', tag, confidence, res);
} else {
console.log('No matches');
}
});
Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.
FAQs
Nodejs binding for Fasttext representation and classification
The npm package fasttext receives a total of 557 weekly downloads. As such, fasttext popularity was classified as not popular.
We found that fasttext demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.