Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # fast-levenshtein - Levenshtein algorithm in Javascript
  2. [![Build Status](https://secure.travis-ci.org/hiddentao/fast-levenshtein.png)](http://travis-ci.org/hiddentao/fast-levenshtein)
  3. [![NPM module](https://badge.fury.io/js/fast-levenshtein.png)](https://badge.fury.io/js/fast-levenshtein)
  4. [![NPM downloads](https://img.shields.io/npm/dm/fast-levenshtein.svg?maxAge=2592000)](https://www.npmjs.com/package/fast-levenshtein)
  5. [![Follow on Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/hiddentao)
  6. An efficient Javascript implementation of the [Levenshtein algorithm](http://en.wikipedia.org/wiki/Levenshtein_distance) with locale-specific collator support.
  7. ## Features
  8. * Works in node.js and in the browser.
  9. * 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)).
  10. * Locale-sensitive string comparisions if needed.
  11. * Comprehensive test suite and performance benchmark.
  12. * Small: <1 KB minified and gzipped
  13. ## Installation
  14. ### node.js
  15. Install using [npm](http://npmjs.org/):
  16. ```bash
  17. $ npm install fast-levenshtein
  18. ```
  19. ### Browser
  20. Using bower:
  21. ```bash
  22. $ bower install fast-levenshtein
  23. ```
  24. If you are not using any module loader system then the API will then be accessible via the `window.Levenshtein` object.
  25. ## Examples
  26. **Default usage**
  27. ```javascript
  28. var levenshtein = require('fast-levenshtein');
  29. var distance = levenshtein.get('back', 'book'); // 2
  30. var distance = levenshtein.get('我愛你', '我叫你'); // 1
  31. ```
  32. **Locale-sensitive string comparisons**
  33. It supports using [Intl.Collator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator) for locale-sensitive string comparisons:
  34. ```javascript
  35. var levenshtein = require('fast-levenshtein');
  36. levenshtein.get('mikailovitch', 'Mikhaïlovitch', { useCollator: true});
  37. // 1
  38. ```
  39. ## Building and Testing
  40. To build the code and run the tests:
  41. ```bash
  42. $ npm install -g grunt-cli
  43. $ npm install
  44. $ npm run build
  45. ```
  46. ## Performance
  47. _Thanks to [Titus Wormer](https://github.com/wooorm) for [encouraging me](https://github.com/hiddentao/fast-levenshtein/issues/1) to do this._
  48. Benchmarked against other node.js levenshtein distance modules (on Macbook Air 2012, Core i7, 8GB RAM):
  49. ```bash
  50. Running suite Implementation comparison [benchmark/speed.js]...
  51. >> levenshtein-edit-distance x 234 ops/sec ±3.02% (73 runs sampled)
  52. >> levenshtein-component x 422 ops/sec ±4.38% (83 runs sampled)
  53. >> levenshtein-deltas x 283 ops/sec ±3.83% (78 runs sampled)
  54. >> natural x 255 ops/sec ±0.76% (88 runs sampled)
  55. >> levenshtein x 180 ops/sec ±3.55% (86 runs sampled)
  56. >> fast-levenshtein x 1,792 ops/sec ±2.72% (95 runs sampled)
  57. Benchmark done.
  58. Fastest test is fast-levenshtein at 4.2x faster than levenshtein-component
  59. ```
  60. You can run this benchmark yourself by doing:
  61. ```bash
  62. $ npm install
  63. $ npm run build
  64. $ npm run benchmark
  65. ```
  66. ## Contributing
  67. If 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.
  68. See [CONTRIBUTING.md](https://github.com/hiddentao/fast-levenshtein/blob/master/CONTRIBUTING.md) for details.
  69. ## License
  70. MIT - see [LICENSE.md](https://github.com/hiddentao/fast-levenshtein/blob/master/LICENSE.md)