wwbnlp 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,361 @@
1
+ Creative Commons Legal Code
2
+
3
+ Attribution-NonCommercial-ShareAlike 3.0 Unported
4
+
5
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
+ LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
7
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
+ REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR
10
+ DAMAGES RESULTING FROM ITS USE.
11
+
12
+ License
13
+
14
+ THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
15
+ COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
16
+ COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
17
+ AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
18
+
19
+ BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
20
+ TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
21
+ BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
22
+ CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
23
+ CONDITIONS.
24
+
25
+ 1. Definitions
26
+
27
+ a. "Adaptation" means a work based upon the Work, or upon the Work and
28
+ other pre-existing works, such as a translation, adaptation,
29
+ derivative work, arrangement of music or other alterations of a
30
+ literary or artistic work, or phonogram or performance and includes
31
+ cinematographic adaptations or any other form in which the Work may be
32
+ recast, transformed, or adapted including in any form recognizably
33
+ derived from the original, except that a work that constitutes a
34
+ Collection will not be considered an Adaptation for the purpose of
35
+ this License. For the avoidance of doubt, where the Work is a musical
36
+ work, performance or phonogram, the synchronization of the Work in
37
+ timed-relation with a moving image ("synching") will be considered an
38
+ Adaptation for the purpose of this License.
39
+ b. "Collection" means a collection of literary or artistic works, such as
40
+ encyclopedias and anthologies, or performances, phonograms or
41
+ broadcasts, or other works or subject matter other than works listed
42
+ in Section 1(g) below, which, by reason of the selection and
43
+ arrangement of their contents, constitute intellectual creations, in
44
+ which the Work is included in its entirety in unmodified form along
45
+ with one or more other contributions, each constituting separate and
46
+ independent works in themselves, which together are assembled into a
47
+ collective whole. A work that constitutes a Collection will not be
48
+ considered an Adaptation (as defined above) for the purposes of this
49
+ License.
50
+ c. "Distribute" means to make available to the public the original and
51
+ copies of the Work or Adaptation, as appropriate, through sale or
52
+ other transfer of ownership.
53
+ d. "License Elements" means the following high-level license attributes
54
+ as selected by Licensor and indicated in the title of this License:
55
+ Attribution, Noncommercial, ShareAlike.
56
+ e. "Licensor" means the individual, individuals, entity or entities that
57
+ offer(s) the Work under the terms of this License.
58
+ f. "Original Author" means, in the case of a literary or artistic work,
59
+ the individual, individuals, entity or entities who created the Work
60
+ or if no individual or entity can be identified, the publisher; and in
61
+ addition (i) in the case of a performance the actors, singers,
62
+ musicians, dancers, and other persons who act, sing, deliver, declaim,
63
+ play in, interpret or otherwise perform literary or artistic works or
64
+ expressions of folklore; (ii) in the case of a phonogram the producer
65
+ being the person or legal entity who first fixes the sounds of a
66
+ performance or other sounds; and, (iii) in the case of broadcasts, the
67
+ organization that transmits the broadcast.
68
+ g. "Work" means the literary and/or artistic work offered under the terms
69
+ of this License including without limitation any production in the
70
+ literary, scientific and artistic domain, whatever may be the mode or
71
+ form of its expression including digital form, such as a book,
72
+ pamphlet and other writing; a lecture, address, sermon or other work
73
+ of the same nature; a dramatic or dramatico-musical work; a
74
+ choreographic work or entertainment in dumb show; a musical
75
+ composition with or without words; a cinematographic work to which are
76
+ assimilated works expressed by a process analogous to cinematography;
77
+ a work of drawing, painting, architecture, sculpture, engraving or
78
+ lithography; a photographic work to which are assimilated works
79
+ expressed by a process analogous to photography; a work of applied
80
+ art; an illustration, map, plan, sketch or three-dimensional work
81
+ relative to geography, topography, architecture or science; a
82
+ performance; a broadcast; a phonogram; a compilation of data to the
83
+ extent it is protected as a copyrightable work; or a work performed by
84
+ a variety or circus performer to the extent it is not otherwise
85
+ considered a literary or artistic work.
86
+ h. "You" means an individual or entity exercising rights under this
87
+ License who has not previously violated the terms of this License with
88
+ respect to the Work, or who has received express permission from the
89
+ Licensor to exercise rights under this License despite a previous
90
+ violation.
91
+ i. "Publicly Perform" means to perform public recitations of the Work and
92
+ to communicate to the public those public recitations, by any means or
93
+ process, including by wire or wireless means or public digital
94
+ performances; to make available to the public Works in such a way that
95
+ members of the public may access these Works from a place and at a
96
+ place individually chosen by them; to perform the Work to the public
97
+ by any means or process and the communication to the public of the
98
+ performances of the Work, including by public digital performance; to
99
+ broadcast and rebroadcast the Work by any means including signs,
100
+ sounds or images.
101
+ j. "Reproduce" means to make copies of the Work by any means including
102
+ without limitation by sound or visual recordings and the right of
103
+ fixation and reproducing fixations of the Work, including storage of a
104
+ protected performance or phonogram in digital form or other electronic
105
+ medium.
106
+
107
+ 2. Fair Dealing Rights. Nothing in this License is intended to reduce,
108
+ limit, or restrict any uses free from copyright or rights arising from
109
+ limitations or exceptions that are provided for in connection with the
110
+ copyright protection under copyright law or other applicable laws.
111
+
112
+ 3. License Grant. Subject to the terms and conditions of this License,
113
+ Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
114
+ perpetual (for the duration of the applicable copyright) license to
115
+ exercise the rights in the Work as stated below:
116
+
117
+ a. to Reproduce the Work, to incorporate the Work into one or more
118
+ Collections, and to Reproduce the Work as incorporated in the
119
+ Collections;
120
+ b. to create and Reproduce Adaptations provided that any such Adaptation,
121
+ including any translation in any medium, takes reasonable steps to
122
+ clearly label, demarcate or otherwise identify that changes were made
123
+ to the original Work. For example, a translation could be marked "The
124
+ original work was translated from English to Spanish," or a
125
+ modification could indicate "The original work has been modified.";
126
+ c. to Distribute and Publicly Perform the Work including as incorporated
127
+ in Collections; and,
128
+ d. to Distribute and Publicly Perform Adaptations.
129
+
130
+ The above rights may be exercised in all media and formats whether now
131
+ known or hereafter devised. The above rights include the right to make
132
+ such modifications as are technically necessary to exercise the rights in
133
+ other media and formats. Subject to Section 8(f), all rights not expressly
134
+ granted by Licensor are hereby reserved, including but not limited to the
135
+ rights described in Section 4(e).
136
+
137
+ 4. Restrictions. The license granted in Section 3 above is expressly made
138
+ subject to and limited by the following restrictions:
139
+
140
+ a. You may Distribute or Publicly Perform the Work only under the terms
141
+ of this License. You must include a copy of, or the Uniform Resource
142
+ Identifier (URI) for, this License with every copy of the Work You
143
+ Distribute or Publicly Perform. You may not offer or impose any terms
144
+ on the Work that restrict the terms of this License or the ability of
145
+ the recipient of the Work to exercise the rights granted to that
146
+ recipient under the terms of the License. You may not sublicense the
147
+ Work. You must keep intact all notices that refer to this License and
148
+ to the disclaimer of warranties with every copy of the Work You
149
+ Distribute or Publicly Perform. When You Distribute or Publicly
150
+ Perform the Work, You may not impose any effective technological
151
+ measures on the Work that restrict the ability of a recipient of the
152
+ Work from You to exercise the rights granted to that recipient under
153
+ the terms of the License. This Section 4(a) applies to the Work as
154
+ incorporated in a Collection, but this does not require the Collection
155
+ apart from the Work itself to be made subject to the terms of this
156
+ License. If You create a Collection, upon notice from any Licensor You
157
+ must, to the extent practicable, remove from the Collection any credit
158
+ as required by Section 4(d), as requested. If You create an
159
+ Adaptation, upon notice from any Licensor You must, to the extent
160
+ practicable, remove from the Adaptation any credit as required by
161
+ Section 4(d), as requested.
162
+ b. You may Distribute or Publicly Perform an Adaptation only under: (i)
163
+ the terms of this License; (ii) a later version of this License with
164
+ the same License Elements as this License; (iii) a Creative Commons
165
+ jurisdiction license (either this or a later license version) that
166
+ contains the same License Elements as this License (e.g.,
167
+ Attribution-NonCommercial-ShareAlike 3.0 US) ("Applicable License").
168
+ You must include a copy of, or the URI, for Applicable License with
169
+ every copy of each Adaptation You Distribute or Publicly Perform. You
170
+ may not offer or impose any terms on the Adaptation that restrict the
171
+ terms of the Applicable License or the ability of the recipient of the
172
+ Adaptation to exercise the rights granted to that recipient under the
173
+ terms of the Applicable License. You must keep intact all notices that
174
+ refer to the Applicable License and to the disclaimer of warranties
175
+ with every copy of the Work as included in the Adaptation You
176
+ Distribute or Publicly Perform. When You Distribute or Publicly
177
+ Perform the Adaptation, You may not impose any effective technological
178
+ measures on the Adaptation that restrict the ability of a recipient of
179
+ the Adaptation from You to exercise the rights granted to that
180
+ recipient under the terms of the Applicable License. This Section 4(b)
181
+ applies to the Adaptation as incorporated in a Collection, but this
182
+ does not require the Collection apart from the Adaptation itself to be
183
+ made subject to the terms of the Applicable License.
184
+ c. You may not exercise any of the rights granted to You in Section 3
185
+ above in any manner that is primarily intended for or directed toward
186
+ commercial advantage or private monetary compensation. The exchange of
187
+ the Work for other copyrighted works by means of digital file-sharing
188
+ or otherwise shall not be considered to be intended for or directed
189
+ toward commercial advantage or private monetary compensation, provided
190
+ there is no payment of any monetary compensation in con-nection with
191
+ the exchange of copyrighted works.
192
+ d. If You Distribute, or Publicly Perform the Work or any Adaptations or
193
+ Collections, You must, unless a request has been made pursuant to
194
+ Section 4(a), keep intact all copyright notices for the Work and
195
+ provide, reasonable to the medium or means You are utilizing: (i) the
196
+ name of the Original Author (or pseudonym, if applicable) if supplied,
197
+ and/or if the Original Author and/or Licensor designate another party
198
+ or parties (e.g., a sponsor institute, publishing entity, journal) for
199
+ attribution ("Attribution Parties") in Licensor's copyright notice,
200
+ terms of service or by other reasonable means, the name of such party
201
+ or parties; (ii) the title of the Work if supplied; (iii) to the
202
+ extent reasonably practicable, the URI, if any, that Licensor
203
+ specifies to be associated with the Work, unless such URI does not
204
+ refer to the copyright notice or licensing information for the Work;
205
+ and, (iv) consistent with Section 3(b), in the case of an Adaptation,
206
+ a credit identifying the use of the Work in the Adaptation (e.g.,
207
+ "French translation of the Work by Original Author," or "Screenplay
208
+ based on original Work by Original Author"). The credit required by
209
+ this Section 4(d) may be implemented in any reasonable manner;
210
+ provided, however, that in the case of a Adaptation or Collection, at
211
+ a minimum such credit will appear, if a credit for all contributing
212
+ authors of the Adaptation or Collection appears, then as part of these
213
+ credits and in a manner at least as prominent as the credits for the
214
+ other contributing authors. For the avoidance of doubt, You may only
215
+ use the credit required by this Section for the purpose of attribution
216
+ in the manner set out above and, by exercising Your rights under this
217
+ License, You may not implicitly or explicitly assert or imply any
218
+ connection with, sponsorship or endorsement by the Original Author,
219
+ Licensor and/or Attribution Parties, as appropriate, of You or Your
220
+ use of the Work, without the separate, express prior written
221
+ permission of the Original Author, Licensor and/or Attribution
222
+ Parties.
223
+ e. For the avoidance of doubt:
224
+
225
+ i. Non-waivable Compulsory License Schemes. In those jurisdictions in
226
+ which the right to collect royalties through any statutory or
227
+ compulsory licensing scheme cannot be waived, the Licensor
228
+ reserves the exclusive right to collect such royalties for any
229
+ exercise by You of the rights granted under this License;
230
+ ii. Waivable Compulsory License Schemes. In those jurisdictions in
231
+ which the right to collect royalties through any statutory or
232
+ compulsory licensing scheme can be waived, the Licensor reserves
233
+ the exclusive right to collect such royalties for any exercise by
234
+ You of the rights granted under this License if Your exercise of
235
+ such rights is for a purpose or use which is otherwise than
236
+ noncommercial as permitted under Section 4(c) and otherwise waives
237
+ the right to collect royalties through any statutory or compulsory
238
+ licensing scheme; and,
239
+ iii. Voluntary License Schemes. The Licensor reserves the right to
240
+ collect royalties, whether individually or, in the event that the
241
+ Licensor is a member of a collecting society that administers
242
+ voluntary licensing schemes, via that society, from any exercise
243
+ by You of the rights granted under this License that is for a
244
+ purpose or use which is otherwise than noncommercial as permitted
245
+ under Section 4(c).
246
+ f. Except as otherwise agreed in writing by the Licensor or as may be
247
+ otherwise permitted by applicable law, if You Reproduce, Distribute or
248
+ Publicly Perform the Work either by itself or as part of any
249
+ Adaptations or Collections, You must not distort, mutilate, modify or
250
+ take other derogatory action in relation to the Work which would be
251
+ prejudicial to the Original Author's honor or reputation. Licensor
252
+ agrees that in those jurisdictions (e.g. Japan), in which any exercise
253
+ of the right granted in Section 3(b) of this License (the right to
254
+ make Adaptations) would be deemed to be a distortion, mutilation,
255
+ modification or other derogatory action prejudicial to the Original
256
+ Author's honor and reputation, the Licensor will waive or not assert,
257
+ as appropriate, this Section, to the fullest extent permitted by the
258
+ applicable national law, to enable You to reasonably exercise Your
259
+ right under Section 3(b) of this License (right to make Adaptations)
260
+ but not otherwise.
261
+
262
+ 5. Representations, Warranties and Disclaimer
263
+
264
+ UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING AND TO THE
265
+ FULLEST EXTENT PERMITTED BY APPLICABLE LAW, LICENSOR OFFERS THE WORK AS-IS
266
+ AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE
267
+ WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT
268
+ LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
269
+ PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS,
270
+ ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT
271
+ DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED
272
+ WARRANTIES, SO THIS EXCLUSION MAY NOT APPLY TO YOU.
273
+
274
+ 6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
275
+ LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
276
+ ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
277
+ ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
278
+ BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ 7. Termination
281
+
282
+ a. This License and the rights granted hereunder will terminate
283
+ automatically upon any breach by You of the terms of this License.
284
+ Individuals or entities who have received Adaptations or Collections
285
+ from You under this License, however, will not have their licenses
286
+ terminated provided such individuals or entities remain in full
287
+ compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
288
+ survive any termination of this License.
289
+ b. Subject to the above terms and conditions, the license granted here is
290
+ perpetual (for the duration of the applicable copyright in the Work).
291
+ Notwithstanding the above, Licensor reserves the right to release the
292
+ Work under different license terms or to stop distributing the Work at
293
+ any time; provided, however that any such election will not serve to
294
+ withdraw this License (or any other license that has been, or is
295
+ required to be, granted under the terms of this License), and this
296
+ License will continue in full force and effect unless terminated as
297
+ stated above.
298
+
299
+ 8. Miscellaneous
300
+
301
+ a. Each time You Distribute or Publicly Perform the Work or a Collection,
302
+ the Licensor offers to the recipient a license to the Work on the same
303
+ terms and conditions as the license granted to You under this License.
304
+ b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
305
+ offers to the recipient a license to the original Work on the same
306
+ terms and conditions as the license granted to You under this License.
307
+ c. If any provision of this License is invalid or unenforceable under
308
+ applicable law, it shall not affect the validity or enforceability of
309
+ the remainder of the terms of this License, and without further action
310
+ by the parties to this agreement, such provision shall be reformed to
311
+ the minimum extent necessary to make such provision valid and
312
+ enforceable.
313
+ d. No term or provision of this License shall be deemed waived and no
314
+ breach consented to unless such waiver or consent shall be in writing
315
+ and signed by the party to be charged with such waiver or consent.
316
+ e. This License constitutes the entire agreement between the parties with
317
+ respect to the Work licensed here. There are no understandings,
318
+ agreements or representations with respect to the Work not specified
319
+ here. Licensor shall not be bound by any additional provisions that
320
+ may appear in any communication from You. This License may not be
321
+ modified without the mutual written agreement of the Licensor and You.
322
+ f. The rights granted under, and the subject matter referenced, in this
323
+ License were drafted utilizing the terminology of the Berne Convention
324
+ for the Protection of Literary and Artistic Works (as amended on
325
+ September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
326
+ Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
327
+ and the Universal Copyright Convention (as revised on July 24, 1971).
328
+ These rights and subject matter take effect in the relevant
329
+ jurisdiction in which the License terms are sought to be enforced
330
+ according to the corresponding provisions of the implementation of
331
+ those treaty provisions in the applicable national law. If the
332
+ standard suite of rights granted under applicable copyright law
333
+ includes additional rights not granted under this License, such
334
+ additional rights are deemed to be included in the License; this
335
+ License is not intended to restrict the license of any rights under
336
+ applicable law.
337
+
338
+
339
+ Creative Commons Notice
340
+
341
+ Creative Commons is not a party to this License, and makes no warranty
342
+ whatsoever in connection with the Work. Creative Commons will not be
343
+ liable to You or any party on any legal theory for any damages
344
+ whatsoever, including without limitation any general, special,
345
+ incidental or consequential damages arising in connection to this
346
+ license. Notwithstanding the foregoing two (2) sentences, if Creative
347
+ Commons has expressly identified itself as the Licensor hereunder, it
348
+ shall have all rights and obligations of Licensor.
349
+
350
+ Except for the limited purpose of indicating to the public that the
351
+ Work is licensed under the CCPL, Creative Commons does not authorize
352
+ the use by either party of the trademark "Creative Commons" or any
353
+ related trademark or logo of Creative Commons without the prior
354
+ written consent of Creative Commons. Any permitted use will be in
355
+ compliance with Creative Commons' then-current trademark usage
356
+ guidelines, as may be published on its website or otherwise made
357
+ available upon request from time to time. For the avoidance of doubt,
358
+ this trademark restriction does not form part of this License.
359
+
360
+ Creative Commons may be contacted at https://creativecommons.org/.
361
+
package/NOTICE.md ADDED
@@ -0,0 +1,28 @@
1
+ # Attribution and licence notices
2
+
3
+ World Wellbeing NLP is maintained by Peter Hughes. It consolidates his
4
+ affectimo, bigfive, darktriad, lex-helpers, optimismo, predictage,
5
+ predictgender, prospectimo, weighted-lexica and wellbeing_analysis projects.
6
+
7
+ The research lexica belong to their cited researchers and the World Well-Being
8
+ Project. Coefficients and adaptations retain Creative Commons
9
+ Attribution-NonCommercial-ShareAlike 3.0 Unported. That licence contains a
10
+ **noncommercial restriction**; this is not an MIT-licensed data package.
11
+
12
+ - WWBP affect/intensity, age/gender, temporal orientation, English PERMA and
13
+ Spanish PERMA notices are retained in `licenses/`.
14
+ - Historical Big Five and Dark Triad data were distributed by Peter Hughes under
15
+ CC BY-NC-SA 3.0 with the research attributions documented in
16
+ `docs/research.md`.
17
+ - The optimism allowlist is from Peter Hughes’s optimismo project under CC
18
+ BY-NC-SA 3.0.
19
+ - MIT notices for the predecessor utility projects lex-helpers (P. Hughes, 2024)
20
+ and weighted-lexica (Peter Hughes, 2020) are retained in `licenses/`.
21
+
22
+ New implementation and documentation: Copyright 2026 Peter Hughes, distributed
23
+ under CC BY-NC-SA 3.0. Existing third-party rights and notices are retained. See
24
+ `LICENSE` for the full licence and `data/provenance.json` for pinned sources and
25
+ transformations.
26
+
27
+ This independent implementation is not affiliated with, endorsed by, or an
28
+ official release of the World Well-Being Project.
package/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # wwbnlp
2
+
3
+ **World Wellbeing NLP** — weighted-lexicon research tools in one typed,
4
+ dependency-free package.
5
+
6
+ Sentiment and arousal, temporal orientation, PERMA in English and Spanish, Big
7
+ Five associations, Dark Triad scores, age and historical binary-gender scores,
8
+ and an experimental optimism composition. This consolidates Peter Hughes’s
9
+ earlier npm modules around one inspectable scoring engine.
10
+
11
+ ## Get started
12
+
13
+ Install [wwbnlp](https://www.npmjs.com/package/wwbnlp) from npm:
14
+
15
+ ```sh
16
+ npm install wwbnlp
17
+ ```
18
+
19
+ Requires Node.js 22.12 or later. ESM and native `require()` on supported Node
20
+ versions use the same module. The package is maintained by
21
+ [phughesmcr](https://www.npmjs.com/~phughesmcr).
22
+
23
+ ```js
24
+ import { analyse } from "wwbnlp";
25
+
26
+ const result = analyse("I love spending time with my family :)", "affect");
27
+ console.log(result.values); // AFFECT and INTENSITY scores, or null without evidence
28
+ console.log(result.matches.AFFECT); // terms, counts, weights, contributions
29
+ console.log(result.info); // original token count and matched feature counts
30
+ ```
31
+
32
+ All analysis runs locally. The package makes no network requests and logs no
33
+ input text.
34
+
35
+ ## Models
36
+
37
+ | Model ID | Replaces | What the scores represent | Default encoding |
38
+ | ----------- | ------------------ | ----------------------------------------------------------------------------------------- | ---------------- |
39
+ | `affect` | affectimo | AFFECT (valence) and INTENSITY (arousal) | frequency |
40
+ | `bigFive` | bigfive | O, C, E, A, N lexical association sums, **not calibrated trait predictions** | binary |
41
+ | `darkTriad` | darktriad | Historical darktriad, machiavellianism, narcissism, psychopathy linear scores | frequency |
42
+ | `optimism` | optimismo | Affect weights restricted to the old future-term vocabulary; **experimental composition** | binary |
43
+ | `age` | predictage | AGE research regression output | frequency |
44
+ | `gender` | predictgender | GENDER historical classifier margin, **not a probability or gender identity** | frequency |
45
+ | `temporal` | prospectimo | PAST, PRESENT, FUTURE linear scores | frequency |
46
+ | `perma` | wellbeing_analysis | English positive/negative P, E, R, M, A lexical components | frequency |
47
+ | `permaEs` | wellbeing_analysis | Spanish positive/negative P, E, R, M, A linear scores | frequency |
48
+
49
+ `lex-helpers` and `weighted-lexica` become `createLexicon`, `score`, and
50
+ `tokenize`. The [`wwbnlp/core`](docs/api.md) entry point loads the generic
51
+ engine without bundled research data.
52
+
53
+ ## Explicit, inspectable results
54
+
55
+ `analyse(textOrTokens, model, options)` always returns the same result shape:
56
+
57
+ - `status`: `ok`, `empty`, or `no-matches`.
58
+ - `values`: every model category; `null` when that category has no evidence.
59
+ - `matches`: per-category `{ term, count, weight, contribution }` records.
60
+ - `featureContributions`: supplied structural covariates and their
61
+ contributions.
62
+ - `info`: `tokenCount`, `featureCount`, `matchedFeatureCount`,
63
+ `uniqueMatchedTerms`.
64
+ - `warnings`: omitted structural features, where relevant.
65
+
66
+ Unmatched input does not silently turn into an intercept-only prediction. Scores
67
+ are neither clamped to a scale nor converted to labels automatically.
68
+
69
+ Frequency encoding is
70
+ `intercept + Σ(weight × occurrences / originalTokenCount)`. Unmatched tokens
71
+ remain in the denominator. Binary encoding adds each matched term’s weight once.
72
+ Percent encoding reports matched candidate-feature occurrences divided by all
73
+ candidate-feature occurrences, excluding weights, intercepts and structural
74
+ covariates.
75
+
76
+ Defaults include every ngram size present in each model’s vocabulary. Supply
77
+ `ngrams: [1]` for unigrams only, or `[]` to disable lexical matching. Ngrams are
78
+ contiguous sequences from the same token stream, including punctuation.
79
+
80
+ ## Reproducibility
81
+
82
+ The convenience tokenizer lowercases, normalizes Unicode to NFC and converts
83
+ curly apostrophes. It preserves accents, social emoticons, punctuation, numbers,
84
+ hashtags and mentions. **It is not the original studies’ tokenizer.** For
85
+ controlled reproductions, pass the exact study token array instead; arrays are
86
+ used as supplied.
87
+
88
+ ```js
89
+ const result = analyse(["really", "good", "!"], "affect", {
90
+ encoding: "frequency",
91
+ includeIntercept: true,
92
+ decimals: 9,
93
+ });
94
+ ```
95
+
96
+ English PERMA includes four named structural covariates. Their weights are
97
+ retained, but their values cannot be inferred reliably from one arbitrary text.
98
+ Supply values measured with your research pipeline via `features`; omitted
99
+ contributions produce warnings. Lexical-only results are not a reproduction of
100
+ the full trained pipeline.
101
+
102
+ See [API](docs/api.md), [migration](docs/migration.md), and
103
+ [research methods and sources](docs/research.md). Each imported file has a
104
+ pinned Git commit and SHA-256 in [data/provenance.json](data/provenance.json).
105
+ `python3 scripts/import-data.py --check` verifies every coefficient against
106
+ those sources.
107
+
108
+ ## Development
109
+
110
+ ```sh
111
+ npm ci
112
+ npm test # shared-engine examples, edge cases and all-model regressions
113
+ npm run check # strict TypeScript, Deno lint and formatting
114
+ npm pack --dry-run # inspect the npm package
115
+ ```
116
+
117
+ Deno 2 is needed for `npm run check`. The built modules also run under Deno; CI
118
+ tests Node 22/24/26 and Deno.
119
+
120
+ ## Research scope and licence
121
+
122
+ These historical social-media lexica produce research scores. The implementation
123
+ does not establish current accuracy, diagnose an individual, or reproduce
124
+ papers’ headline performance. Domain, language, tokenization and missing
125
+ covariates affect results. The demographic models reflect historical training
126
+ labels; Big Five associations and the optimism composition are not validated
127
+ standalone predictors.
128
+
129
+ Research coefficients retain **CC BY-NC-SA 3.0**, including the noncommercial
130
+ restriction. The package uses the same licence. Original MIT utility notices are
131
+ retained in `licenses/`; see [NOTICE.md](NOTICE.md) for attribution. This is an
132
+ independent implementation, not an official WWBP distribution.
@@ -0,0 +1,67 @@
1
+ {
2
+ "imported": "2026-10-04",
3
+ "sources": [
4
+ {
5
+ "repository": "wwbp/lexica",
6
+ "commit": "abaff9a1ae90757cfe77770fafbfcd16c92cd992",
7
+ "path": "affect_intensity/affect_intensity_lexicon.csv",
8
+ "sha256": "e8fd205f5d11ef6b51d6f5c88bf3998b35416e7e4d3f71b38c01820496b1c5cd"
9
+ },
10
+ {
11
+ "repository": "wwbp/lexica",
12
+ "commit": "abaff9a1ae90757cfe77770fafbfcd16c92cd992",
13
+ "path": "age_gender/emnlp14age.csv",
14
+ "sha256": "e7ea6de87b1d73a0e8e7615d27fdbfe25322949d2dfe66ea0b400c193b06ce1b"
15
+ },
16
+ {
17
+ "repository": "wwbp/lexica",
18
+ "commit": "abaff9a1ae90757cfe77770fafbfcd16c92cd992",
19
+ "path": "age_gender/emnlp14gender.csv",
20
+ "sha256": "2ed49285defa8c9c5b16f8443cbe134985b412071b7fdf8e4cc35d15294fcdab"
21
+ },
22
+ {
23
+ "repository": "wwbp/lexica",
24
+ "commit": "abaff9a1ae90757cfe77770fafbfcd16c92cd992",
25
+ "path": "temporal_orientation/temporal_orientation_lexicon.csv",
26
+ "sha256": "eba7978e9918ee1508ff64024ab10252e3cce1240238d373b226a55e9a504bc1"
27
+ },
28
+ {
29
+ "repository": "wwbp/lexica",
30
+ "commit": "abaff9a1ae90757cfe77770fafbfcd16c92cd992",
31
+ "path": "perma/permaV3_dd.csv",
32
+ "sha256": "6d954bbcf19d3690060b593b126930b0c580c0b5d45ef1ea95c0c544dece7079"
33
+ },
34
+ {
35
+ "repository": "wwbp/lexica",
36
+ "commit": "abaff9a1ae90757cfe77770fafbfcd16c92cd992",
37
+ "path": "spanish_perma/spanish_perma_v1.csv",
38
+ "sha256": "f57f3045fa641e25edca4ba2daee21c2ca140c7428110bde870ab737a9a19bae"
39
+ },
40
+ {
41
+ "repository": "phughesmcr/bigfive",
42
+ "commit": "6d928f158e6ad7977d43340d60513421b6a90863",
43
+ "path": "data/lexicon.json",
44
+ "sha256": "73206a96dd40fa877d42b00ac6237401fe802ee86b3a6bc1b1a3d2da67ee3ca3"
45
+ },
46
+ {
47
+ "repository": "phughesmcr/darktriad",
48
+ "commit": "f3d71c3b883489b3cccfd9e6263713032e68be49",
49
+ "path": "data/lexicon.json",
50
+ "sha256": "e55bd316f7d4f97d048c890ee15bf58d9bf29601e693d040e513a2271138d8b1"
51
+ },
52
+ {
53
+ "repository": "phughesmcr/optimismo",
54
+ "commit": "229a71b92ec692863430a3c83aa0725d10edfd2b",
55
+ "path": "data/future.json",
56
+ "sha256": "232099a4332a8274062947d363ca0be6147cd74d2c4c09f3ae6073be8f7166c5"
57
+ }
58
+ ],
59
+ "transformations": [
60
+ "CSV category labels mapped to historical public names; intercept and named structural features separated from lexical terms.",
61
+ "Spanish PERMA restored from original UTF-8 WWBP CSV rather than corrupted legacy JSON.",
62
+ "Optimism is the intersection of historical future-term allowlist and canonical affect weights; an experimental composition, not a separately trained model.",
63
+ "Big Five and Dark Triad retain historical repository weights.",
64
+ "An empty-string term with weight 0.078492 in the historical Big Five O category is excluded: it cannot represent a token.",
65
+ "Default ngram sizes are derived from the actual vocabulary, including age/gender phrases omitted by the historical wrappers."
66
+ ]
67
+ }