New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-fasttext

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-fasttext

A facebookresearch/fastText wrapper in node js.

latest
npmnpm
Version
1.0.0-alpha.1
Version published
Weekly downloads
17
70%
Maintainers
1
Weekly downloads
 
Created
Source

node-fasttext

npm install --save node-fasttext

To import: var FastText = require('node-fasttext');

Training

let config = { 
  dim: 100,
  input: "data/dbpedia.train",
  output: "dbpedia"
}

FastText.train("supervised", config, function (success, error) {

  if(error) {
    console.log(error)
    return;
  }
  
  console.log(success)
  
})

Print Vector

FastText.printVectors(
"dbpedia.bin",
['word', 'word', 'another', 'words', 'here'],
function (success, error) {

  if(error) {
    console.log(error)
    return;
  }

  console.log(success.length)
})

Print model info

FastText.modelInfo("dbpedia.bin", function (success, error) {

  if(error) {
    console.log(error)
    return;
  }
  
  console.log(success)
  
})

Test a model

FastText.test("dbpedia.bin", "data/dbpedia.test", 1, function (data, error) {
  if(error) {
    console.log(error)
    return;
  }
  console.log(data)
  
});

Predict

FastText.predict(
"dbpedia.bin", 1,
['cola lukei , cola lukei is a species of flowering plant in the malvaceae family . it is found only in tanzania . its natural habitat is subtropical or tropical moist lowland forests . it is threatened by habitat loss .'],
function (success, error) {

  if(error) {
    console.log(error)
    return;
  }

  console.log(success[0].label == '__label__11')
  console.log(success)
})

Keywords

fasttext

FAQs

Package last updated on 12 Dec 2016

Did you know?

Socket

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