natural 6.7.1 → 6.8.0
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.
|
@@ -24,18 +24,20 @@ const dutchLexicon = require('../data/Dutch/brill_Lexicon.json')
|
|
|
24
24
|
const DEBUG = false
|
|
25
25
|
|
|
26
26
|
// Constructor creates a Lexicon for language
|
|
27
|
-
function Lexicon (language, defaultCategory, defaultCategoryCapitalised) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
function Lexicon (language, defaultCategory, defaultCategoryCapitalised, extendedLexicon) {
|
|
28
|
+
const lexicon = (() => {
|
|
29
|
+
switch (language) {
|
|
30
|
+
case 'EN':
|
|
31
|
+
return englishLexicon
|
|
32
|
+
case 'DU':
|
|
33
|
+
return dutchLexicon
|
|
34
|
+
default:
|
|
35
|
+
return dutchLexicon
|
|
36
|
+
}
|
|
37
|
+
})()
|
|
38
|
+
|
|
39
|
+
this.lexicon = Object.assign(lexicon, extendedLexicon || {})
|
|
40
|
+
|
|
39
41
|
if (defaultCategory) {
|
|
40
42
|
this.defaultCategory = defaultCategory
|
|
41
43
|
if (defaultCategoryCapitalised) {
|
|
@@ -102,7 +102,7 @@ function distance (s1, s2) {
|
|
|
102
102
|
// s2 is the second string to compare
|
|
103
103
|
// dj is the Jaro Distance (if you've already computed it), leave blank and the method handles it
|
|
104
104
|
// ignoreCase: if true strings are first converted to lower case before comparison
|
|
105
|
-
function JaroWinklerDistance (s1, s2, options) {
|
|
105
|
+
function JaroWinklerDistance (s1, s2, options = {}) {
|
|
106
106
|
if (s1 === s2) {
|
|
107
107
|
return 1
|
|
108
108
|
} else {
|
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": "6.
|
|
4
|
+
"version": "6.8.0",
|
|
5
5
|
"homepage": "https://github.com/NaturalNode/natural",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|