Socket
Socket
Sign inDemoInstall

languagemodel

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    languagemodel

A natural language model and cross-language model, for natural language understanding and generation


Version published
Weekly downloads
209
increased by78.63%
Maintainers
1
Install size
54.9 kB
Created
Weekly downloads
 

Readme

Source

languagemodel

"A statistical language model assigns a probability to a sequence of m words P(w_1,\ldots,w_m) by means of a probability distribution." (Wikipedia)

This module provides a unigram-based cross-lingual language model, inspired by: Leuski Anton, Traum David. A Statistical Approach for Text Processing in Virtual Humans tech. rep.University of Southern California, Institute for Creative Technologies 2008.

A CrossLanguageModel can be used as a multi-class classifier/ranker, but, it also takes into account the structure of the output classes.

install

npm install languagemodel

use

var CrossLanguageModel = require('languagemodel').CrossLanguageModel;

var model = new CrossLanguageModel({
    smoothingFactor : 0.9
});

model.trainBatch([
    {input: {i:1, want:1, aa:1}, output: {a:1}},
    {input: {i:1, want:1, bb:1}, output: {b:1}},
    {input: {i:1, want:1, cc:1}, output: {c:1}},
    ]);

console.dir(model.similarities({i:1, want:1, aa:1, and:1, bb:1}));

==>

[ { output: { a: 1 }, similarity: -0.29506393100486217 },
  { output: { b: 1 }, similarity: -0.29506393100486217 },
  { output: { c: 1 }, similarity: -0.6413224201123425 } ]

Keywords

FAQs

Last updated on 13 Nov 2013

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