{"name":"fast-levenshtein","version":"1.0.6","description":"Efficient implementation of Levenshtein algorithm with asynchronous callback support","main":"levenshtein.js","scripts":{"build":"grunt build","benchmark":"grunt benchmark"},"devDependencies":{"lodash":"~1.2.0","chai":"~1.5.0","mocha":"~1.9.0","grunt-contrib-uglify":"~0.2.0","grunt":"~0.4.1","grunt-contrib-jshint":"~0.4.3","grunt-mocha-test":"~0.2.2","grunt-npm-install":"~0.1.0","load-grunt-tasks":"~0.6.0","grunt-benchmark":"~0.2.0"},"repository":{"type":"git","url":"https://github.com/hiddentao/fast-levenshtein.git"},"keywords":["levenshtein","distance","string"],"author":{"name":"Ramesh Nair","email":"ram@hiddentao.com","url":"http://www.hiddentao.com/"},"license":"MIT","readme":"# fast-levenshtein - Levenshtein algorithm in Javascript\n\n[![Build Status](https://secure.travis-ci.org/hiddentao/fast-levenshtein.png)](http://travis-ci.org/hiddentao/fast-levenshtein)\n\nAn efficient Javascript implementation of the [Levenshtein algorithm](http://en.wikipedia.org/wiki/Levenshtein_distance) with asynchronous callback support.\n\n## Features\n\n* Works in node.js and in the browser.\n* Better performance than other implementations by not needing to store the whole matrix ([more info](http://www.codeproject.com/Articles/13525/Fast-memory-efficient-Levenshtein-algorithm)).\n* Provides synchronous and asynchronous versions of the algorithm.\n* Asynchronous version is almost as fast as the synchronous version for small strings and can also provide progress updates.\n* Comprehensive test suite and performance benchmark.\n* Small: <1 KB minified and gzipped\n\n## Installation\n\n### node.js\n\nInstall using [npm](http://npmjs.org/):\n\n```bash\n$ npm install fast-levenshtein\n```\n\n### Browser\n\nUsing bower:\n\n```bash\n$ bower install fast-levenshtein\n```\n\nIf you are not using any module loader system then the API will then be accessible via the `window.Levenshtein` object.\n\n## Examples\n\n**Synchronous**\n\n```javascript\nvar levenshtein = require('fast-levenshtein');\n\nvar distance = levenshtein.get('back', 'book');   // 2\nvar distance = levenshtein.get('我愛你', '我叫你');   // 1\n```\n\n**Asynchronous**\n\n```javascript\nvar levenshtein = require('fast-levenshtein');\n\nlevenshtein.getAsync('back', 'book', function (err, distance) {\n  // err is null unless an error was thrown\n  // distance equals 2\n});\n```\n\n**Asynchronous with progress updates**\n\n```javascript\nvar levenshtein = require('fast-levenshtein');\n\nvar hugeText1 = fs.readFileSync(...);\nvar hugeText2 = fs.readFileSync(...);\n\nlevenshtein.getAsync(hugeText1, hugeText2, function (err, distance) {\n  // process the results as normal\n}, {\n  progress: function(percentComplete) {\n    console.log(percentComplete + ' % completed so far...');\n  }\n);\n```\n\n## Building and Testing\n\nTo build the code and run the tests:\n\n```bash\n$ npm install -g grunt-cli\n$ npm install\n$ npm run build\n```\n\n## Performance\n\n_Thanks to [Titus Wormer](https://github.com/wooorm) for [encouraging me](https://github.com/hiddentao/fast-levenshtein/issues/1) to do this._\n\nBenchmarked against other node.js levenshtein distance modules (on Macbook Air 2012, Core i7, 8GB RAM):\n\n```bash\nRunning suite Implementation comparison [benchmark/speed.js]...\n>> levenshtein-edit-distance x 234 ops/sec ±3.02% (73 runs sampled)\n>> levenshtein-component x 422 ops/sec ±4.38% (83 runs sampled)\n>> levenshtein-deltas x 283 ops/sec ±3.83% (78 runs sampled)\n>> natural x 255 ops/sec ±0.76% (88 runs sampled)\n>> levenshtein x 180 ops/sec ±3.55% (86 runs sampled)\n>> fast-levenshtein x 1,792 ops/sec ±2.72% (95 runs sampled)\nBenchmark done.\nFastest test is fast-levenshtein at 4.2x faster than levenshtein-component\n```\n\nYou can run this benchmark yourself by doing:\n\n```bash\n$ npm install -g grunt-cli\n$ npm install\n$ npm run build\n$ npm run benchmark\n```\n\n## Contributing\n\nIf you wish to submit a pull request please update and/or create new tests for any changes you make and ensure the grunt build passes.\n\nSee [CONTRIBUTING.md](https://github.com/hiddentao/fast-levenshtein/blob/master/CONTRIBUTING.md) for details.\n\n## License\n\nMIT - see [LICENSE.md](https://github.com/hiddentao/fast-levenshtein/blob/master/LICENSE.md)\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/hiddentao/fast-levenshtein/issues"},"homepage":"https://github.com/hiddentao/fast-levenshtein","_id":"fast-levenshtein@1.0.6","_shasum":"3bedb184e39f95cb0d88928688e6b1ee3273446a","_from":"https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-1.0.6.tgz","_resolved":"https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-1.0.6.tgz"}