Skip to content

Commit

Permalink
[api] Created wrapper to @gf3 's Levenshtein module.
Browse files Browse the repository at this point in the history
  • Loading branch information
AvianFlu committed Jun 11, 2011
1 parent c20a6f9 commit 33f4997
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions 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.