prospectimo
Get the temporal orientation of a string.
Usage
const prospectimo = require('prospectimo');
const opts = {
'return': 'lex',
'encoding': 'binary',
'threshold': -0.98
}
const str = "A big long string of text...";
const orientation = prospectimo(str, opts);
console.log(orientation);
Options
'return'
Valid options: 'lex' (default), or 'orientation'.
'lex' returns an object with 'PAST', 'PRESENT' and 'FUTURE' keys, each containing a lexical value for that orientation.
'orientation' returns a string stating either 'Past', 'Present', 'Future', or 'Unknown'.
'encoding'
Valid options: 'binary' (default), or 'frequency'.
'binary' calculates the lexical value as simply a sum of weights, i.e. weight[1] + weight[2] + etc...
'frequency' calculates the lexical value as (word frequency / total wordcount) * word weight
Unless you have a specific need for frequency encoding, we recommend you use binary only.
'threshold'
The lexicon contains weight values that are very small. You can exclude them using the threshold option.
The smallest value in the lexicon is -0.9772179. Therefore a threshold of -0.98 will include all words in the lexicon.
The largest value in the lexicon is 1.15807005. Therefore a threshold of 1.16 will include no words in the lexicon.
Acknowledgements
References
Park, G., Schwartz, H.A., Sap, M., Kern, M.L., Weingarten, E., Eichstaedt, J.C., Berger, J., Stillwell, D.J., Kosinski, M., Ungar, L.H. & Seligman, M.E. (2015). Living in the Past, Present, and Future: Measuring Temporal Orientation with Language. Journal of personality.
Lexicon
Using the prospection lexicon data from WWBP
Used under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported
Licence
(C) 2017 P. Hughes
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported