Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including cosine with all npm packages installed. Try it out:

var cosine = require("cosine")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

cosine v0.0.1

calculate the cosine distance between 2 arrays of strings

cosine

NPM version Build Status Dependency Status Coverage Status Code Climate

install

npm install [--save/--save-dev] cosine
component install cosine

api

var cosine = require('cosine')

var s1 = 'Julie loves me more than Linda loves me'.split(/\s/)
var s2 = 'Jane likes me more than Julie loves me or'.split(/\s/)

cosine(s1, s2) // => 0.7833494518006403

license

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free