Comparing version 0.0.66 to 0.0.67
@@ -25,2 +25,3 @@ /* | ||
exports.Metaphone = require('./phonetics/metaphone'); | ||
exports.DoubleMetaphone = require('./phonetics/double_metaphone'); | ||
exports.PorterStemmer = require('./stemmers/porter_stemmer'); | ||
@@ -27,0 +28,0 @@ exports.LancasterStemmer = require('./stemmers/lancaster_stemmer'); |
@@ -490,3 +490,12 @@ /* | ||
function compare(stringA, stringB) { | ||
var encodingsA = process(stringA), | ||
encodingsB = process(stringB); | ||
return encodingsA[0] == encodingsB[0] || | ||
encodingsA[1] == encodingsB[1]; | ||
}; | ||
DoubleMetaphone.compare = compare | ||
DoubleMetaphone.process = process; | ||
DoubleMetaphone.isVowel = isVowel; |
{ | ||
"name": "natural", | ||
"description": "General natural language (tokenizing, stemming, classification, inflection, phonetics, tfidf, WordNet) facilities for node.", | ||
"version": "0.0.66", | ||
"version": "0.0.67", | ||
"homepage": "https://github.com/NaturalNode/natural", | ||
@@ -6,0 +6,0 @@ "engines": { |
@@ -142,4 +142,4 @@ | ||
Phonetic matching (sounds-like) matching can be done with either the SoundEx or | ||
Metaphone algorithms | ||
Phonetic matching (sounds-like) matching can be done withthe SoundEx, | ||
Metaphone or DoubleMetaphone algorithms | ||
@@ -174,2 +174,11 @@ var natural = require('natural'), | ||
DoubleMetaphone deals with two encodings returned in an array | ||
var natural = require('natural'), | ||
var dm = natural.DoubleMetaphone; | ||
var encodings = dm.process('Matrix'); | ||
console.log(encodings[0]); | ||
console.log(encodings[1]); | ||
full text strings can be tokenized into arrays of phonetics similar to stemmers | ||
@@ -176,0 +185,0 @@ |
@@ -704,5 +704,10 @@ | ||
expect(encodings[0]).toMatch(/ANTRFNXN/); | ||
expect(encodings[1]).toMatch(/ANTRFNXN/); | ||
expect(encodings[1]).toMatch(/ANTRFNXN/); | ||
}); | ||
it('should compare', function() { | ||
expect(doubleMetaphone.compare('love', 'hate')).toBeFalsy(); | ||
expect(doubleMetaphone.compare('love', 'luv')).toBeTruthy(); | ||
}); | ||
}); | ||
}); |
283390
5784
481