natural 8.2.1 → 8.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -417,8 +417,8 @@ class DoubleMetaphone extends Phonetic {
417
417
  } else if (pos === token.length - 1 &&
418
418
  subMatch(-2, 0, ['AI', 'OI'])) {
419
419
  addSecondary('', 'S')
420
- } else if (token[pos + 1] !== 'L' && (
421
- token[pos - 1] !== 'A' && token[pos - 1] !== 'I')) {
420
+ } else if (!subMatch(-1, 2, ['ISL', 'YSL'])) {
421
+ // Only the complete ISL and YSL sequences have a silent S here.
422
422
  addCompressedDouble('S')
423
423
  if (token[pos + 1] === 'Z') { pos++ }
424
424
  }
@@ -29,7 +29,9 @@ class SoundEx extends Phonetic {
29
29
  token = token.toLowerCase()
30
30
  let transformed = this.condense(this.transform(token.substr(1, token.length - 1))) // anything that isn't a digit goes
31
31
  // deal with duplicate INITIAL consonant SOUNDS
32
- transformed = transformed.replace(new RegExp('^' + this.transform(token.charAt(0))), '')
32
+ if (transformed.charAt(0) === this.transform(token.charAt(0))) {
33
+ transformed = transformed.slice(1)
34
+ }
33
35
  return token.charAt(0).toUpperCase() + this.padRight0(transformed.replace(/\D/g, '')).substr(0, (maxLength && maxLength - 1) || 3)
34
36
  }
35
37
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "natural",
3
3
  "description": "General natural language (tokenizing, stemming (English, Russian, Spanish), part-of-speech tagging, sentiment analysis, classification, inflection, phonetics, tfidf, WordNet, jaro-winkler, Levenshtein distance, Dice's Coefficient) facilities for node.",
4
- "version": "8.2.1",
4
+ "version": "8.2.3",
5
5
  "homepage": "https://github.com/NaturalNode/natural",
6
6
  "repository": {
7
7
  "type": "git",