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

document-distance

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

document-distance

Compute how similar two documents are, in the sense of: how many words overlap in these documents.

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

node-document-distance Build Status

Document Distance Problem - d(D1, D2)

The document distance problem has applications in finding similar documents, detecting duplicates (Wikipedia mirrors and Google) and plagiarism, and also in web search (D2 = query).

The idea is to define distance in terms of shared words.

Install

$ npm install --save document-distance

Usage

var fs = require('fs');
var documentDistance = require('document-distance');

fs.readFile('file1.txt', function(err, dataFile1) {
	if(err) throw err;
	
	fs.readFile('file2.txt', function(err, dataFile2) {
		if(err) throw err;
		
		documentDistance(dataFile1.toString(), dataFile2.toString()); //=> 0.8410686705679303
	});
});


API

documentDistance(document1, document2)

document1

Required
Type: string

document2

Required
Type: string

License

MIT © Vinícius do Carmo

Keywords

document distance

FAQs

Package last updated on 20 Jul 2015

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