Permalink
Browse files

words ending in H no longer break double metaphone

  • Loading branch information...
1 parent 8ed7d29 commit 03c6ed38809f25848a390b8d675e3c319cb25460 @chrisumbel chrisumbel committed Apr 20, 2012
Showing with 8 additions and 2 deletions.
  1. +1 −1 lib/natural/phonetics/double_metaphone.js
  2. +1 −1 package.json
  3. +6 −0 spec/double_metaphone_spec.js
@@ -26,7 +26,7 @@ var DoubleMetaphone = new Phonetic();
module.exports = DoubleMetaphone;
function isVowel(c) {
- return c.match(/[aeiouy]/i);
+ return c && c.match(/[aeiouy]/i);
}
function truncate(string, length) {
View
@@ -1,7 +1,7 @@
{
"name": "natural",
"description": "General natural language (tokenizing, stemming, classification, inflection, phonetics, tfidf, WordNet, jaro-winkler, Levenshtein distance, Dice's Coefficient) facilities for node.",
- "version": "0.1.7",
+ "version": "0.1.8",
"homepage": "https://github.com/NaturalNode/natural",
"engines": {
"node": ">=0.4.10"
@@ -734,4 +734,10 @@ describe('double metaphone', function() {
expect(doubleMetaphone.compare('love', 'luv')).toBeTruthy();
});
});
+
+ describe('issue #34', function() {
+ it('terminate words ending in H', function() {
+ expect(doubleMetaphone.process('ptah')).toEqual(['PT', 'PT']);
+ });
+ });
});

0 comments on commit 03c6ed3

Please sign in to comment.