natural 5.2.0 → 5.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.
|
@@ -154,10 +154,10 @@ Sentences.prototype.type = function (cbf) {
|
|
|
154
154
|
if (lastElement.pos !== '.') {
|
|
155
155
|
if (implicitYou) {
|
|
156
156
|
this.senType = 'COMMAND'
|
|
157
|
-
} else if (_(['WDT', 'WP', 'WP$', 'WRB']
|
|
157
|
+
} else if (_.contains(['WDT', 'WP', 'WP$', 'WRB'], this.posObj.tags[0].pos)) {
|
|
158
158
|
// Sentences that start with: who, what where when why and how, then they are questions
|
|
159
159
|
this.senType = 'INTERROGATIVE'
|
|
160
|
-
} else if (_(['PRP']
|
|
160
|
+
} else if (_.contains(['PRP'], lastElement.pos)) {
|
|
161
161
|
// Sentences that end in a Personal pronoun are most likely questions
|
|
162
162
|
// eg. We should run away, should we [?]
|
|
163
163
|
// eg. You want to see that again, do you [?]
|
|
@@ -179,7 +179,7 @@ Sentences.prototype.type = function (cbf) {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
if (callbackFunction && _
|
|
182
|
+
if (callbackFunction && _.isFunction(callbackFunction)) {
|
|
183
183
|
callbackFunction(this)
|
|
184
184
|
} else {
|
|
185
185
|
return this.senType
|
|
@@ -37,7 +37,7 @@ exports.trigrams = function (sequence, startSymbol, endSymbol) {
|
|
|
37
37
|
const ngrams = function (sequence, n, startSymbol, endSymbol) {
|
|
38
38
|
const result = []
|
|
39
39
|
|
|
40
|
-
if (!_
|
|
40
|
+
if (!_.isArray(sequence)) {
|
|
41
41
|
sequence = sequence.split('')
|
|
42
42
|
}
|
|
43
43
|
|
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": "5.2.
|
|
4
|
+
"version": "5.2.3",
|
|
5
5
|
"homepage": "https://github.com/NaturalNode/natural",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|