rita 3.0.17 → 3.0.19

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/README.md CHANGED
@@ -1,9 +1,9 @@
1
- <a href="https://github.com/dhowe/rjs3/actions"><img src="https://github.com/dhowe/rjs3/actions/workflows/node.js.yml/badge.svg" alt="ci tests"></a> <a href="https://www.gnu.org/licenses/gpl-3.0.en.html"><img src="https://img.shields.io/badge/license-GPL-orange.svg" alt="license"></a> <a href="https://www.npmjs.com/package/rita"><img src="https://img.shields.io/npm/v/rita.svg" alt="npm version"></a> <!--[![](https://data.jsdelivr.com/v1/package/npm/rita/badge)](https://www.jsdelivr.com/package/npm/rita)--> [![CDNJS](https://img.shields.io/cdnjs/v/rita.svg)](https://cdnjs.com/libraries/rita/)
1
+ <a href="https://github.com/dhowe/rjs3/actions"><img src="https://github.com/dhowe/rjs3/actions/workflows/node.js.yml/badge.svg" alt="ci tests"></a> <a href="https://www.npmjs.com/package/rita"><img src="https://img.shields.io/npm/v/rita.svg" alt="npm version"></a> <a href="https://www.gnu.org/licenses/gpl-3.0.en.html"><img src="https://img.shields.io/badge/license-GPL-orange.svg" alt="license"></a>
2
2
 
3
3
 
4
- ## RiTa: tools for generative natural language
4
+ ## RiTa: tools for computational writing
5
5
 
6
- RiTa is implemented in JavaScript and Java, with a common [API](https://github.com/dhowe/rita4j/blob/master/README.md#api) for both, and is free/libre/open-source via the GPL license.
6
+ RiTa is implemented in JavaScript and Java, with a common [API](https://github.com/dhowe/rita4j/blob/master/README.md#api) for both, and is free/libre/open-source.
7
7
 
8
8
  ### Features in v3.0
9
9
 
@@ -14,18 +14,21 @@ RiTa is implemented in JavaScript and Java, with a common [API](https://github.c
14
14
  * New options for generation via grammars and Markov chains
15
15
  * Published in ESM, CommonJS and as an IIFE
16
16
 
17
- Note: version 3.0 contains breaking changes -- please check the [release notes](https://rednoise.org/rita/#whats-new-wrapper)
17
+ Note: version 3.0 contains breaking changes -- please check the [release notes](https://rednoise.org/rita/#whats-new)
18
18
 
19
19
  ### Installation
20
20
 
21
- * For node: `npm install rita`
22
- * For [browsers](#a-simple-sketch): ```<script src="https://unpkg.com/rita"></script>```
21
+ * For [esm](#an-esm-browser-sketch): ```import { RiTa } from "https://esm.sh/rita";```
22
+ * For [node](#with-nodejs-and-npm): `$ npm install rita`
23
+ ```let { RiTa } = require('rita');```
24
+ * For [browsers](#a-simple-browser-sketch): ```<script src="https://unpkg.com/rita"></script>```
23
25
  * For [developers](#developing)
24
26
 
25
- ### Example (node)
27
+
28
+ ### Example
26
29
 
27
30
  ```javascript
28
- let RiTa = require('rita');
31
+ import { RiTa } from "https://esm.sh/rita";
29
32
 
30
33
  // to analyze a sentence
31
34
  let data = RiTa.analyze("The elephant took a bite!");
@@ -117,7 +120,7 @@ console.log(grammar.expand());
117
120
 
118
121
  ## RiScript
119
122
 
120
- RiScript is a writer-focused scripting language integrated with RiTa. It enables simple generative primitives within plain text for dynamic expansion at runtime. RiScript primitives can be used as part of any [RiTa grammar](https://rednoise.org/rita/reference/RiTa/grammar/) or executed directly using [RiTa.evaluate()](https://rednoise.org/rita/reference/RiTa/evaluate/). For more info, see [this interactive notebook](https://observablehq.com/@dhowe/riscript).
123
+ RiScript is a minor language designed for writers working in computational media. RiScript primitives -- choices, symbols, gates, transforms, etc. -- can be used as part of any RiTa [grammar](https://rednoise.org/rita/reference/RiTa/grammar/) or executed directly using [RiTa.evaluate](https://rednoise.org/rita/reference/RiTa/evaluate/). For more info, see [this interactive notebook](https://observablehq.com/@dhowe/riscript) on observable.
121
124
 
122
125
  <br>
123
126
 
@@ -133,7 +136,7 @@ $ git clone https://github.com/dhowe/ritajs.git
133
136
  $ cd ritajs
134
137
  $ npm install
135
138
  $ npm run build
136
- $ npm run test
139
+ $ npm test
137
140
 
138
141
  ```
139
142
  If all goes well, you should see a list of successful tests and find the library built in 'dist'
@@ -148,7 +151,7 @@ Please make contributions via [fork-and-pull](https://reflectoring.io/github-for
148
151
 
149
152
  ### Visual Studio Code
150
153
 
151
- Once you have things running with npm/mocha, you might also try [VSCode](https://code.visualstudio.com/).
154
+ Once you have things running with npm/mocha/tsup, you might also try [VSCode](https://code.visualstudio.com/).
152
155
 
153
156
  Some of the following extensions may also be useful:
154
157
 
@@ -169,32 +172,49 @@ Here you can see the tests in the VSCode _Testing_ view
169
172
  * Github Repo: [https://github.com/dhowe/rita](https://github.com/dhowe/rita)
170
173
  * Issues: [https://github.com/dhowe/rita/issues](https://github.com/dhowe/rita/issues)
171
174
  * Reference: [https://rednoise.org/rita/reference](http://rednoise.org/rita/reference)
175
+ * RiScript: [https://github.com/dhowe/riscript](https://github.com/dhowe/riscript)
172
176
 
173
177
  &nbsp;
174
178
 
175
179
  ## Quick Start
176
180
 
177
- #### A simple sketch
181
+ #### A simple browser sketch
178
182
 
179
183
  Create a new file on your desktop called 'test.html' with the following lines, save and drag it into a browser:
180
184
 
181
185
  ```html
182
186
  <html>
183
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
184
187
  <script src="https://unpkg.com/rita"></script>
185
188
  <script>
186
189
  window.onload = function() {
187
190
  let words = RiTa.tokenize("The elephant took a bite!");
188
- $('#content').text(words);
191
+ document.getElementById("content").innerHTML = words;
189
192
  };
190
193
  </script>
191
194
  <div id="content" width=200 height=200></div>
192
195
  <html>
193
196
  ```
194
197
 
198
+ #### An ESM browser sketch
199
+
200
+ Create a new file on your desktop called 'test.html' with the following lines, save and drag it into a browser:
201
+
202
+ ```html
203
+ <html>
204
+ <body>
205
+ <div id="content" width=200 height=200></div>
206
+ <script type="module">
207
+ import { RiTa } from "https://esm.sh/rita";
208
+ let words = RiTa.tokenize("The elephant took a bite!");
209
+ document.getElementById("content").innerHTML = words;
210
+ </script>
211
+ </body>
212
+ <html>
213
+ ```
214
+
195
215
  #### With [p5.js](http://p5js.org/)
196
216
 
197
- Create a new file on your desktop called 'test.html' and download the latest rita.js from [here](http://rednoise.org/rita/download/rita.min.js), add the following lines, save and drag it into a browser:
217
+ Create a new file on your desktop called 'test.html' with the following lines, save and drag it into a browser:
198
218
 
199
219
  ```html
200
220
  <html>
@@ -204,13 +224,13 @@ Create a new file on your desktop called 'test.html' and download the latest rit
204
224
  function setup() {
205
225
 
206
226
  createCanvas(200,200);
207
- background(50);
227
+ background(245);
228
+ textAlign(CENTER);
208
229
  textSize(20);
209
- noStroke();
210
230
 
211
231
  let words = RiTa.tokenize("The elephant took a bite!")
212
232
  for (let i=0; i < words.length; i++) {
213
- text(words[i], 50, 50 + i*20);
233
+ text(words[i], 100, 50 + i*20);
214
234
  }
215
235
  }
216
236
  </script>
package/dist/rita.cjs CHANGED
@@ -42622,7 +42622,7 @@ RiTa2.conjugator = new conjugator_default(RiTa2);
42622
42622
  RiTa2.SILENT = false;
42623
42623
  RiTa2.SILENCE_LTS = false;
42624
42624
  RiTa2.PHONES = ["aa", "ae", "ah", "ao", "aw", "ay", "b", "ch", "d", "dh", "eh", "er", "ey", "f", "g", "hh", "ih", "iy", "jh", "k", "l", "m", "n", "ng", "ow", "oy", "p", "r", "s", "sh", "t", "th", "uh", "uw", "v", "w", "y", "z", "zh"];
42625
- RiTa2.VERSION = "3.0.17";
42625
+ RiTa2.VERSION = "3.0.19";
42626
42626
  RiTa2.HAS_LEXICON = typeof __NOLEX__ === "undefined";
42627
42627
  RiTa2.FIRST = 1;
42628
42628
  RiTa2.SECOND = 2;