@stdlib/datasets-afinn-96 0.0.8 → 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/CITATION.cff ADDED
@@ -0,0 +1,30 @@
1
+ cff-version: 1.2.0
2
+ title: stdlib
3
+ message: >-
4
+ If you use this software, please cite it using the
5
+ metadata from this file.
6
+
7
+ type: software
8
+
9
+ authors:
10
+ - name: The Stdlib Authors
11
+ url: https://github.com/stdlib-js/stdlib/graphs/contributors
12
+
13
+ repository-code: https://github.com/stdlib-js/stdlib
14
+ url: https://stdlib.io
15
+
16
+ abstract: |
17
+ Standard library for JavaScript and Node.js.
18
+
19
+ keywords:
20
+ - JavaScript
21
+ - Node.js
22
+ - TypeScript
23
+ - standard library
24
+ - scientific computing
25
+ - numerical computing
26
+ - statistical computing
27
+
28
+ license: Apache-2.0 AND BSL-1.0
29
+
30
+ date-released: 2016
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2021 The Stdlib Authors.
1
+ Copyright (c) 2016-2023 The Stdlib Authors.
package/README.md CHANGED
@@ -18,9 +18,20 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
21
32
  # AFINN-96
22
33
 
23
- [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
24
35
 
25
36
  > A [list][afinn] of English words rated for [valence][valence].
26
37
 
@@ -117,72 +128,7 @@ console.dir( dict );
117
128
 
118
129
  <!-- /.examples -->
119
130
 
120
- * * *
121
-
122
- <section class="cli">
123
-
124
- ## CLI
125
-
126
- <section class="installation">
127
-
128
- ## Installation
129
-
130
- To use the module as a general utility, install the module globally
131
-
132
- ```bash
133
- npm install -g @stdlib/datasets-afinn-96
134
- ```
135
-
136
- </section>
137
-
138
- <section class="usage">
139
-
140
- ### Usage
141
-
142
- ```text
143
- Usage: afinn-96 [options]
144
-
145
- Options:
146
-
147
- -h, --help Print this message.
148
- -V, --version Print the package version.
149
- --format fmt Output format: 'csv' or 'ndjson'.
150
- ```
151
-
152
- </section>
153
-
154
- <!-- /.usage -->
155
-
156
- <section class="notes">
157
-
158
- ### Notes
159
-
160
- - The CLI supports two output formats: comma-separated values ([CSV][csv]) and newline-delimited JSON ([NDJSON][ndjson]). The default output format is [CSV][csv].
161
-
162
- </section>
163
-
164
- <!-- /.notes -->
165
-
166
- <section class="examples">
167
-
168
- ### Examples
169
-
170
- ```bash
171
- $ afinn-96
172
- word,valence
173
- abandon,-2
174
- abandons,-2
175
- abandoned,-2
176
- ...
177
- ```
178
-
179
- </section>
180
-
181
- <!-- /.examples -->
182
-
183
- </section>
184
131
 
185
- <!-- /.cli -->
186
132
 
187
133
  * * *
188
134
 
@@ -205,6 +151,21 @@ The data files (databases) are licensed under an [Open Data Commons Attribution
205
151
 
206
152
  <!-- </license> -->
207
153
 
154
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
155
+
156
+ <section class="related">
157
+
158
+ ## See Also
159
+
160
+ - <span class="package-name">[`@stdlib/datasets-afinn-96-cli`][@stdlib/datasets-afinn-96-cli]</span><span class="delimiter">: </span><span class="description">CLI package for use as a command-line utility.</span>
161
+ - <span class="package-name">[`@stdlib/datasets-afinn-111`][@stdlib/datasets/afinn-111]</span><span class="delimiter">: </span><span class="description">A list of English words rated for valence.</span>
162
+
163
+ </section>
164
+
165
+ <!-- /.related -->
166
+
167
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
168
+
208
169
 
209
170
  <section class="main-repo" >
210
171
 
@@ -224,7 +185,7 @@ For more information on the project, filing bug reports and feature requests, an
224
185
 
225
186
  ## Copyright
226
187
 
227
- Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
188
+ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
228
189
 
229
190
  </section>
230
191
 
@@ -234,25 +195,43 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
234
195
 
235
196
  <section class="links">
236
197
 
198
+ [@stdlib/datasets-afinn-96-cli]: https://www.npmjs.com/package/@stdlib/datasets-afinn-96-cli
199
+
237
200
  [npm-image]: http://img.shields.io/npm/v/@stdlib/datasets-afinn-96.svg
238
201
  [npm-url]: https://npmjs.org/package/@stdlib/datasets-afinn-96
239
202
 
240
- [test-image]: https://github.com/stdlib-js/datasets-afinn-96/actions/workflows/test.yml/badge.svg
241
- [test-url]: https://github.com/stdlib-js/datasets-afinn-96/actions/workflows/test.yml
203
+ [test-image]: https://github.com/stdlib-js/datasets-afinn-96/actions/workflows/test.yml/badge.svg?branch=v0.1.0
204
+ [test-url]: https://github.com/stdlib-js/datasets-afinn-96/actions/workflows/test.yml?query=branch:v0.1.0
242
205
 
243
206
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/datasets-afinn-96/main.svg
244
207
  [coverage-url]: https://codecov.io/github/stdlib-js/datasets-afinn-96?branch=main
245
208
 
209
+ <!--
210
+
246
211
  [dependencies-image]: https://img.shields.io/david/stdlib-js/datasets-afinn-96.svg
247
212
  [dependencies-url]: https://david-dm.org/stdlib-js/datasets-afinn-96/main
248
213
 
214
+ -->
215
+
249
216
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
250
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
217
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
251
218
 
252
219
  [stdlib]: https://github.com/stdlib-js/stdlib
253
220
 
254
221
  [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
255
222
 
223
+ [cli-section]: https://github.com/stdlib-js/datasets-afinn-96#cli
224
+ [cli-url]: https://github.com/stdlib-js/datasets-afinn-96/tree/cli
225
+ [@stdlib/datasets-afinn-96]: https://github.com/stdlib-js/datasets-afinn-96/tree/main
226
+
227
+ [umd]: https://github.com/umdjs/umd
228
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
229
+
230
+ [deno-url]: https://github.com/stdlib-js/datasets-afinn-96/tree/deno
231
+ [umd-url]: https://github.com/stdlib-js/datasets-afinn-96/tree/umd
232
+ [esm-url]: https://github.com/stdlib-js/datasets-afinn-96/tree/esm
233
+ [branches-url]: https://github.com/stdlib-js/datasets-afinn-96/blob/main/branches.md
234
+
256
235
  [afinn]: http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6010
257
236
 
258
237
  [@hansen:2011a]: https://doi.org/10.1007/978-3-642-22309-9_5
@@ -269,6 +248,12 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
269
248
 
270
249
  [apache-license]: https://www.apache.org/licenses/LICENSE-2.0
271
250
 
251
+ <!-- <related-links> -->
252
+
253
+ [@stdlib/datasets/afinn-111]: https://www.npmjs.com/package/@stdlib/datasets-afinn-111
254
+
255
+ <!-- </related-links> -->
256
+
272
257
  </section>
273
258
 
274
259
  <!-- /.links -->
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import afinn96 from '../docs/types/index';
3
+ export = afinn96;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var n=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var t=n(function(d,a){
2
+ var s=require("path").resolve,i=require('@stdlib/fs-read-json/dist').sync,o=s(__dirname,"..","data","words.json"),u={encoding:"utf8"};function v(){var r=i(o,u);if(r instanceof Error)throw r;return r}a.exports=v
3
+ });var f=t();module.exports=f;
4
+ /** @license Apache-2.0 */
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar resolve = require( 'path' ).resolve;\nvar readJSON = require( '@stdlib/fs-read-json' ).sync;\n\n\n// VARIABLES //\n\nvar fpath = resolve( __dirname, '..', 'data', 'words.json' );\nvar opts = {\n\t'encoding': 'utf8'\n};\n\n\n// MAIN //\n\n/**\n* Returns a list of English words rated for valence. An earlier version of AFINN-111.\n*\n* ## Notes\n*\n* - This function synchronously reads data from disk for each invocation. Such behavior is intentional and so is the avoidance of `require`. We assume that invocations are infrequent, and we want to avoid the `require` cache. This means that we allow data to be garbage collected and a user is responsible for explicitly caching data.\n*\n* @throws {Error} unable to read data\n* @returns {ArrayArray} word ratings\n*\n* @example\n* var list = afinn96();\n* // returns [ ['abandon',-2], ['abandons',-2], ['abandoned',-2], ... ]\n*/\nfunction afinn96() {\n\tvar data = readJSON( fpath, opts );\n\tif ( data instanceof Error ) {\n\t\tthrow data;\n\t}\n\treturn data;\n}\n\n\n// EXPORTS //\n\nmodule.exports = afinn96;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* A list of English words rated for valence. An earlier version of AFINN-111.\n*\n* @module @stdlib/datasets-afinn-96\n*\n* @example\n* var afinn96 = require( '@stdlib/datasets-afinn-96' );\n* var words = afinn96();\n* // returns [ ['abandon',-2], ['abandons',-2], ['abandoned',-2], ... ]\n*/\n\n// MODULES //\n\nvar afinn96 = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = afinn96;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAU,QAAS,MAAO,EAAE,QAC5BC,EAAW,QAAS,sBAAuB,EAAE,KAK7CC,EAAQF,EAAS,UAAW,KAAM,OAAQ,YAAa,EACvDG,EAAO,CACV,SAAY,MACb,EAmBA,SAASC,GAAU,CAClB,IAAIC,EAAOJ,EAAUC,EAAOC,CAAK,EACjC,GAAKE,aAAgB,MACpB,MAAMA,EAEP,OAAOA,CACR,CAKAN,EAAO,QAAUK,IC5BjB,IAAIE,EAAU,IAKd,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "resolve", "readJSON", "fpath", "opts", "afinn96", "data", "afinn96"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /**
22
22
  * Two-element array holding a word and its associated valence rating.
package/lib/main.js CHANGED
@@ -41,7 +41,6 @@ var opts = {
41
41
  *
42
42
  * - This function synchronously reads data from disk for each invocation. Such behavior is intentional and so is the avoidance of `require`. We assume that invocations are infrequent, and we want to avoid the `require` cache. This means that we allow data to be garbage collected and a user is responsible for explicitly caching data.
43
43
  *
44
- *
45
44
  * @throws {Error} unable to read data
46
45
  * @returns {ArrayArray} word ratings
47
46
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/datasets-afinn-96",
3
- "version": "0.0.8",
3
+ "version": "0.1.0",
4
4
  "description": "A list of English words rated for valence.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -13,9 +13,6 @@
13
13
  "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14
14
  }
15
15
  ],
16
- "bin": {
17
- "afinn-96": "./bin/cli"
18
- },
19
16
  "main": "./lib",
20
17
  "browser": "./lib/browser.js",
21
18
  "directories": {
@@ -42,23 +39,14 @@
42
39
  "url": "https://github.com/stdlib-js/stdlib/issues"
43
40
  },
44
41
  "dependencies": {
45
- "@stdlib/cli-ctor": "^0.0.x",
46
- "@stdlib/fs-read-file": "^0.0.x",
47
- "@stdlib/fs-read-json": "^0.0.x",
48
- "@stdlib/streams-node-stdout": "^0.0.x",
49
- "@stdlib/utils-copy": "^0.0.x"
42
+ "@stdlib/fs-read-json": "^0.1.0",
43
+ "@stdlib/utils-copy": "^0.1.0"
50
44
  },
51
45
  "devDependencies": {
52
- "@stdlib/assert-is-array": "^0.0.x",
53
- "@stdlib/assert-is-browser": "^0.0.x",
54
- "@stdlib/assert-is-windows": "^0.0.x",
55
- "@stdlib/bench": "^0.0.x",
56
- "@stdlib/process-exec-path": "^0.0.x",
57
- "@stdlib/regexp-eol": "^0.0.x",
58
46
  "proxyquire": "^2.0.0",
59
47
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
60
48
  "istanbul": "^0.4.1",
61
- "tap-spec": "5.x.x"
49
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git"
62
50
  },
63
51
  "engines": {
64
52
  "node": ">=0.10.0",
@@ -100,7 +88,7 @@
100
88
  "en"
101
89
  ],
102
90
  "funding": {
103
- "type": "patreon",
104
- "url": "https://www.patreon.com/athan"
91
+ "type": "opencollective",
92
+ "url": "https://opencollective.com/stdlib"
105
93
  }
106
94
  }
package/bin/cli DELETED
@@ -1,100 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * @license Apache-2.0
5
- *
6
- * Copyright (c) 2018 The Stdlib Authors.
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- */
20
-
21
- 'use strict';
22
-
23
- // MODULES //
24
-
25
- var createReadStream = require( 'fs' ).createReadStream;
26
- var resolve = require( 'path' ).resolve;
27
- var readFileSync = require( '@stdlib/fs-read-file' ).sync;
28
- var stdout = require( '@stdlib/streams-node-stdout' );
29
- var CLI = require( '@stdlib/cli-ctor' );
30
-
31
-
32
- // MAIN //
33
-
34
- /**
35
- * Main execution sequence.
36
- *
37
- * @private
38
- */
39
- function main() {
40
- var flags;
41
- var cli;
42
-
43
- // Create a command-line interface:
44
- cli = new CLI({
45
- 'pkg': require( './../package.json' ),
46
- 'options': require( './../etc/cli_opts.json' ),
47
- 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), {
48
- 'encoding': 'utf8'
49
- })
50
- });
51
-
52
- // Get any provided command-line options:
53
- flags = cli.flags();
54
- if ( flags.help || flags.version ) {
55
- return;
56
- }
57
- if ( flags.format === 'ndjson' ) {
58
- ndjson();
59
- } else {
60
- csv();
61
- }
62
-
63
- /**
64
- * Prints data as newline-delimited JSON (ndjson).
65
- *
66
- * @private
67
- */
68
- function ndjson() {
69
- var data;
70
- var i;
71
-
72
- data = require( './../data/words.json' );
73
- for ( i = 0; i < data.length; i++ ) {
74
- console.log( JSON.stringify( data[i] ) ); // eslint-disable-line no-console
75
- }
76
- }
77
-
78
- /**
79
- * Prints data as lines of comma-separated values (CSV).
80
- *
81
- * @private
82
- */
83
- function csv() {
84
- var fpath = resolve( __dirname, '..', 'data', 'words.csv' );
85
- createReadStream( fpath )
86
- .pipe( stdout )
87
- .on( 'close', onClose );
88
- }
89
-
90
- /**
91
- * Exits the CLI.
92
- *
93
- * @private
94
- */
95
- function onClose() {
96
- cli.close( 0 );
97
- }
98
- }
99
-
100
- main();
package/docs/repl.txt DELETED
@@ -1,42 +0,0 @@
1
-
2
- {{alias}}()
3
- Returns a list of English words rated for valence.
4
-
5
- The returned list contains 1468 English words (and phrases) rated for
6
- valence. Negative words have a negative valence [-5,0). Positive words have
7
- a positive valence (0,5]. Neutral words have a valence of 0.
8
-
9
- A few notes:
10
-
11
- - The list is an earlier version of AFINN-111.
12
- - The list includes misspelled words. Their presence is intentional, as such
13
- misspellings frequently occur in social media content.
14
- - All words are lowercase.
15
- - Some "words" are phrases; e.g., "cashing in", "cool stuff".
16
- - Words may contain apostrophes; e.g., "can't stand".
17
- - Words may contain dashes; e.g., "cover-up", "made-up".
18
-
19
- Returns
20
- -------
21
- out: Array<Array>
22
- List of English words and their valence.
23
-
24
- Examples
25
- --------
26
- > var list = {{alias}}()
27
- [ [ 'abandon', -2 ], [ 'abandons', -2 ], [ 'abandoned', -2 ], ... ]
28
-
29
- References
30
- ----------
31
- - Nielsen, Finn Årup. 2011. "A new ANEW: Evaluation of a word list for
32
- sentiment analysis in microblogs." In *Proceedings of the ESWC2011 Workshop
33
- on 'Making Sense of Microposts': Big Things Come in Small Packages.*,
34
- 718:93–98. CEUR Workshop Proceedings. <http://ceur-ws.org/Vol-718/paper_16.
35
- pdf>.
36
-
37
- * If you use the list for publication or third party consumption, please
38
- cite the listed reference.
39
-
40
- See Also
41
- --------
42
-
@@ -1,32 +0,0 @@
1
- /*
2
- * @license Apache-2.0
3
- *
4
- * Copyright (c) 2020 The Stdlib Authors.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- import afinn96 = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns an array of word ratings...
25
- {
26
- afinn96(); // $ExpectType [string, number][]
27
- }
28
-
29
- // The compiler throws an error if the function is provided arguments...
30
- {
31
- afinn96( 3.12 ); // $ExpectError
32
- }
package/docs/usage.txt DELETED
@@ -1,9 +0,0 @@
1
-
2
- Usage: afinn-96 [options]
3
-
4
- Options:
5
-
6
- -h, --help Print this message.
7
- -V, --version Print the package version.
8
- --format fmt Output format: 'csv' or 'ndjson'.
9
-
package/etc/cli_opts.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "boolean": [
3
- "help",
4
- "version"
5
- ],
6
- "string": [
7
- "format"
8
- ],
9
- "alias": {
10
- "help": [
11
- "h"
12
- ],
13
- "version": [
14
- "V"
15
- ]
16
- }
17
- }