prospectimo
Advanced tools
Comparing version 0.1.1 to 0.1.2
25
index.js
/** | ||
* prospectimo | ||
* v0.1.1 | ||
* v0.1.2 | ||
* | ||
@@ -108,11 +108,13 @@ * Analyse the temporal orientation of a string. | ||
let lex = 0 | ||
counts.forEach(function (a, b) { | ||
let i | ||
let len = counts.length | ||
for (i = 0; i < len; i++) { | ||
if (enc === 'frequency') { | ||
lex += (a / wc) * weights[b] | ||
lex += (counts[i] / wc) * weights[i] | ||
} else { | ||
lex += weights[b] | ||
lex += weights[i] | ||
} | ||
}) | ||
} | ||
// add int | ||
lex = lex + int | ||
lex += int | ||
// return final lexical value + intercept | ||
@@ -154,3 +156,3 @@ return lex | ||
// make sure there is input before proceeding | ||
if (str == null) return null | ||
if (str == null) return { 'PAST': 0, 'PRESENT': 0, 'FUTURE': 0 } | ||
// if str isn't a string, make it into one | ||
@@ -174,10 +176,3 @@ if (typeof str !== 'string') str = str.toString() | ||
// if no tokens return null | ||
if (tokens == null) { | ||
let lex = { | ||
'PAST': 0, | ||
'PRESENT': 0, | ||
'FUTURE': 0 | ||
} | ||
return lex | ||
} | ||
if (tokens == null) return { 'PAST': 0, 'PRESENT': 0, 'FUTURE': 0 } | ||
// get matches from array | ||
@@ -184,0 +179,0 @@ const matches = getMatches(tokens) |
{ | ||
"name": "prospectimo", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Analyse the temporal orientation of a string.", | ||
"main": "index.js", | ||
"dependencies": { | ||
"happynodetokenizer": "^0.0.4" | ||
"happynodetokenizer": "^0.1.0" | ||
}, | ||
@@ -17,3 +17,4 @@ "keywords": [ | ||
"analysis", | ||
"predict" | ||
"predict", | ||
"sentiment" | ||
], | ||
@@ -20,0 +21,0 @@ "author": "P. Hughes <peter@phugh.es> (http://www.phugh.es)", |
53078
195
+ Addedhappynodetokenizer@0.1.2(transitive)
- Removedhappynodetokenizer@0.0.4(transitive)
Updatedhappynodetokenizer@^0.1.0