Skip to content
Browse files

[api] Created wrapper to @gf3 's Levenshtein module.

  • Loading branch information...
1 parent c20a6f9 commit 33f4997235aab3cddebe24a8b576229654e2249b @AvianFlu committed Jun 10, 2011
Showing with 19 additions and 0 deletions.
  1. +19 −0 lib/levenshtein.js
View
19 lib/levenshtein.js
@@ -0,0 +1,19 @@
+#! /usr/bin/env node
+var Hook = require('hook.io').Hook,
+ Levenshtein = require('levenshtein');
+
+var insult = new Hook( {
+ name: 'levenshtein'
+});
+
+insult.connect({
+ port: 5000,
+ host: "localhost"
+});
+
+insult.on('ready', function(){
+ insult.on('in.getDistance', function(string1, string2){
+ var lev = new Levenshtein(string1, string2);
+ insult.emit('out.getDistance', lev.distance);
+ });
+});

0 comments on commit 33f4997

Please sign in to comment.
Something went wrong with that request. Please try again.