Socket
Book a DemoInstallSign in
Socket

machine-translator

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

machine-translator

translate languages using a statistical model

0.8.3
latest
Source
npmnpm
Version published
Maintainers
3
Created
Source

travis build Codecov version license semantic-release Commitizen friendly

machine-translator

is a nodejs module that uses statistical machine translation to translate between two different languages. the module is loosely based off of the IBM model 1 algorithm and has been tested using english.

Install:

$ npm install machine-translator

Usage:

This module requires:

  • A native corpus of text (i.e. english text file)
  • A matching foreign corpus of text (i.e. german text file)

Example

var Translator = require('machine-translator');

var t = new Translator();

t.train('./tests/data/shortEN.txt', './tests/data/shortDE.txt');

t.translate('cat'); // { die: 0.5, Katze: 0.5 }
t.translate('the'); // { der: 0.2, Hund: 0.2, die: 0.2, Katze: 0.2, Bus: 0.2 }
t.translate('car'); // Error: No matches found!

NPM Commands

We have some NPM commands to help testing/linting:

npm run test:watch

npm run lint

npm run lint:watch
# lint in watch mode

npm run compile
# important!! needs to be run before release, note how main script points to dist instead of src

License:

MIT License 2015-2018 © Andy Craze & Contributors

Keywords

language

FAQs

Package last updated on 05 Jan 2020

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.