marlarky 1.0.0 → 1.0.2

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,489 +1,503 @@
1
- # Marlarky
2
-
3
- **Generate syntactically plausible English nonsense, steered by lexicons.**
4
-
5
- Marlarky is a faker-like library and CLI that produces grammatically correct English text that sounds meaningful but isn't. Perfect for:
6
-
7
- - Placeholder text generation (like Lorem Ipsum, but in English)
8
- - Testing and mocking
9
- - Creative writing prompts
10
- - Procedural content generation
11
- - Corporate buzzword bingo
12
-
13
- ## Features
14
-
15
- - **Syntactically correct** -- Proper grammar, subject-verb agreement, punctuation
16
- - **Lexicon-driven** -- Guide output with custom vocabularies and style presets
17
- - **Deterministic** -- Seedable RNG for reproducible output
18
- - **Configurable** -- Control sentence types, lengths, complexity
19
- - **Output transforms** -- Pipe text through built-in transforms (Pig Latin, leet speak, pirate, and more)
20
- - **Traceable** -- Debug mode shows exactly how text was generated
21
- - **Full CLI** -- Generate text, apply transforms, and validate lexicons from the command line
22
- - **Zero dependencies** -- Works standalone or with @faker-js/faker
23
-
24
- ## Installation
25
-
26
- ```bash
27
- npm install marlarky
28
- ```
29
-
30
- ## Quick Start
31
-
32
- ### TypeScript / JavaScript
33
-
34
- ```typescript
35
- import { TextGenerator, SimpleFakerAdapter } from 'marlarky';
36
-
37
- const generator = new TextGenerator({
38
- fakerAdapter: new SimpleFakerAdapter(),
39
- });
40
-
41
- generator.setSeed(42);
42
-
43
- console.log(generator.sentence());
44
- // "Generally, the change called."
45
-
46
- console.log(generator.paragraph({ sentences: 3 }));
47
- // Three sentences of plausible nonsense
48
-
49
- console.log(generator.textBlock({ paragraphs: 2 }));
50
- // Two paragraphs of corporate-sounding marlarky
51
- ```
52
-
53
- ### Command Line
54
-
55
- ```bash
56
- # Generate a sentence
57
- marlarky sentence
58
-
59
- # Generate a deterministic question
60
- marlarky sentence --seed 42 --type question
61
-
62
- # Generate a paragraph with a corporate lexicon
63
- marlarky paragraph --sentences 5 --lexicon ./corp.json --archetype corporate
64
-
65
- # Apply Pig Latin transform and output as JSON
66
- marlarky sentence --seed 42 --transform pigLatin --json
67
- ```
68
-
69
- ## CLI
70
-
71
- After installing globally (`npm install -g marlarky`) or locally, the `marlarky` command is available.
72
-
73
- ### Commands
74
-
75
- | Command | Description |
76
- | ------------ | ----------------------------------------------- |
77
- | `sentence` | Generate one or more sentences |
78
- | `paragraph` | Generate one or more paragraphs |
79
- | `text` | Generate a text block (multiple paragraphs) |
80
- | `validate` | Validate a lexicon JSON file |
81
- | `list` | List available transforms or sentence types |
82
-
83
- ### Global Options
84
-
85
- These options work with `sentence`, `paragraph`, and `text`:
86
-
87
- | Option | Short | Description |
88
- | -------------------------- | ----- | -------------------------------------------------------- |
89
- | `--seed <n>` | `-s` | RNG seed for deterministic output |
90
- | `--lexicon <path>` | `-l` | Path to a lexicon JSON file |
91
- | `--archetype <name>` | `-a` | Archetype to activate from the lexicon |
92
- | `--transform <id>` | `-x` | Apply an output transform (repeatable, comma-separated) |
93
- | `--trace` | `-t` | Output JSON trace to stderr |
94
- | `--json` | `-j` | Output full result as JSON to stdout |
95
- | `--count <n>` | `-n` | Number of items to generate (default: 1) |
96
- | `--help` | `-h` | Show help |
97
- | `--version` | `-v` | Show version |
98
-
99
- ### Generating Sentences
100
-
101
- ```bash
102
- # Random sentence
103
- marlarky sentence
104
-
105
- # Specific type
106
- marlarky sentence --type question
107
- marlarky sentence --type compound
108
- marlarky sentence --type subordinate
109
-
110
- # Control word count
111
- marlarky sentence --min-words 10 --max-words 20
112
-
113
- # Multiple sentences
114
- marlarky sentence --count 5
115
-
116
- # With hints (activate lexicon tags)
117
- marlarky sentence --hints domain:tech,register:formal
118
- ```
119
-
120
- ### Generating Paragraphs
121
-
122
- ```bash
123
- # Random paragraph
124
- marlarky paragraph
125
-
126
- # Control sentence count
127
- marlarky paragraph --sentences 5
128
- marlarky paragraph --min-sentences 3 --max-sentences 8
129
-
130
- # Multiple paragraphs
131
- marlarky paragraph --count 3
132
- ```
133
-
134
- ### Generating Text Blocks
135
-
136
- ```bash
137
- # Random text block
138
- marlarky text
139
-
140
- # Control paragraph count
141
- marlarky text --paragraphs 4
142
- marlarky text --min-paragraphs 2 --max-paragraphs 6
143
- ```
144
-
145
- ### Applying Transforms
146
-
147
- Use `--transform` (or `-x`) to pipe generated text through built-in transforms:
148
-
149
- ```bash
150
- # Pig Latin
151
- marlarky sentence --seed 42 --transform pigLatin
152
- # "Enerallygay, ethay angechay alledcay."
153
-
154
- # Leet speak
155
- marlarky sentence --seed 42 --transform leet
156
-
157
- # Chain multiple transforms (comma-separated)
158
- marlarky sentence --seed 42 --transform leet,uwu
159
-
160
- # Or use repeated flags
161
- marlarky sentence --seed 42 -x pirate -x mockCase
162
- ```
163
-
164
- Run `marlarky list transforms` to see all available transforms.
165
-
166
- ### JSON Output
167
-
168
- Use `--json` (or `-j`) to get structured output including metadata and trace:
169
-
170
- ```bash
171
- marlarky sentence --seed 42 --json
172
- ```
173
-
174
- ```json
175
- {
176
- "text": "Generally, the change called.",
177
- "trace": { "..." : "..." },
178
- "meta": {
179
- "archetype": "default",
180
- "seed": 42
181
- }
182
- }
183
- ```
184
-
185
- ### Validating Lexicons
186
-
187
- ```bash
188
- # Human-readable output
189
- marlarky validate ./my-lexicon.json
190
-
191
- # Machine-readable JSON output
192
- marlarky validate ./my-lexicon.json --json
193
- ```
194
-
195
- ### Listing Available Features
196
-
197
- ```bash
198
- # List all output transforms
199
- marlarky list transforms
200
-
201
- # List all sentence types
202
- marlarky list types
203
-
204
- # Output as JSON
205
- marlarky list transforms --json
206
- ```
207
-
208
- ## Output Transforms
209
-
210
- Marlarky includes 10 built-in output transforms that modify generated text at the token level. All transforms are deterministic (same seed = same output) and safe to chain.
211
-
212
- | Transform | Description |
213
- | --------------- | ----------------------------------------- |
214
- | `pigLatin` | Classic Pig Latin |
215
- | `ubbiDubbi` | Ubbi Dubbi language game |
216
- | `leet` | Leetspeak character substitution |
217
- | `uwu` | Cute speak (w-substitution, suffixes) |
218
- | `pirate` | Pirate speak |
219
- | `redact` | Redact/mask words |
220
- | `emoji` | Add emoji replacements |
221
- | `mockCase` | rAnDoM cAsE aLtErNaTiOn |
222
- | `reverseWords` | Reverse word order |
223
- | `bizJargon` | Business jargon patterns |
224
-
225
- ### Using Transforms in Code
226
-
227
- ```typescript
228
- const result = generator.sentence({
229
- outputTransforms: {
230
- enabled: true,
231
- pipeline: [{ id: 'pigLatin' }],
232
- },
233
- });
234
- ```
235
-
236
- Transforms can also be configured at the lexicon level or per-archetype in your lexicon JSON. See the [usage guide](usage.md#output-transforms) for details.
237
-
238
- ## Sentence Types
239
-
240
- Marlarky generates six sentence structures:
241
-
242
- ```typescript
243
- // Simple declarative: "The system processes data."
244
- generator.sentence({ type: 'simpleDeclarative' });
245
-
246
- // Question: "Does the team deliver results?"
247
- generator.sentence({ type: 'question' });
248
-
249
- // Compound: "The strategy evolved, and the metrics improved."
250
- generator.sentence({ type: 'compound' });
251
-
252
- // Subordinate clause: "Because the pipeline scales, the throughput increases."
253
- generator.sentence({ type: 'subordinate' });
254
-
255
- // Intro adverbial: "Furthermore, the initiative drives innovation."
256
- generator.sentence({ type: 'introAdverbial' });
257
-
258
- // Interjection: "Indeed, the team delivered results."
259
- generator.sentence({ type: 'interjection' });
260
- ```
261
-
262
- ## Deterministic Output
263
-
264
- Same seed produces the same text every time:
265
-
266
- ```typescript
267
- generator.setSeed(12345);
268
- const a = generator.sentence();
269
-
270
- generator.setSeed(12345);
271
- const b = generator.sentence();
272
-
273
- console.log(a === b); // true
274
- ```
275
-
276
- From the CLI:
277
-
278
- ```bash
279
- marlarky sentence --seed 12345
280
- marlarky sentence --seed 12345
281
- # Both print the same sentence
282
- ```
283
-
284
- ## Custom Lexicons
285
-
286
- Create domain-specific marlarky with JSON lexicon files:
287
-
288
- ```json
289
- {
290
- "id": "lexicon.startup",
291
- "language": "en",
292
- "termSets": {
293
- "noun.startup": {
294
- "pos": "noun",
295
- "tags": ["domain:startup"],
296
- "terms": [
297
- { "value": "disruptor", "weight": 5 },
298
- { "value": "unicorn", "weight": 3 },
299
- { "value": "pivot", "weight": 4 },
300
- { "value": "runway", "weight": 2 }
301
- ]
302
- },
303
- "verb.startup": {
304
- "pos": "verb",
305
- "tags": ["domain:startup"],
306
- "terms": [
307
- { "value": "disrupt", "weight": 5 },
308
- { "value": "scale", "weight": 4 },
309
- { "value": "pivot", "weight": 3 },
310
- { "value": "iterate", "weight": 3 }
311
- ]
312
- }
313
- },
314
- "archetypes": {
315
- "startup": {
316
- "tags": ["domain:startup"]
317
- }
318
- }
319
- }
320
- ```
321
-
322
- Load it in code:
323
-
324
- ```typescript
325
- import { TextGenerator, SimpleFakerAdapter, loadLexiconFromString } from 'marlarky';
326
- import { readFileSync } from 'fs';
327
-
328
- const lexicon = loadLexiconFromString(readFileSync('./startup.json', 'utf-8'));
329
-
330
- const generator = new TextGenerator({
331
- fakerAdapter: new SimpleFakerAdapter(),
332
- lexicon,
333
- });
334
-
335
- generator.setArchetype('startup');
336
- console.log(generator.paragraph());
337
- ```
338
-
339
- Or from the CLI:
340
-
341
- ```bash
342
- marlarky paragraph --lexicon ./startup.json --archetype startup
343
- ```
344
-
345
- See the [usage guide](usage.md#lexicon-schema) for the full lexicon schema reference.
346
-
347
- ## Morphology Utilities
348
-
349
- Marlarky exports standalone English morphology functions:
350
-
351
- ```typescript
352
- import {
353
- pluralize,
354
- singularize,
355
- getPastTense,
356
- getPresentParticiple,
357
- getThirdPersonSingular,
358
- getIndefiniteArticle,
359
- } from 'marlarky';
360
-
361
- pluralize('synergy'); // "synergies"
362
- pluralize('child'); // "children"
363
- singularize('stakeholders'); // "stakeholder"
364
- getPastTense('leverage'); // "leveraged"
365
- getPastTense('go'); // "went"
366
- getPresentParticiple('run'); // "running"
367
- getThirdPersonSingular('do'); // "does"
368
- getIndefiniteArticle('hour'); // "an"
369
- getIndefiniteArticle('user'); // "a"
370
- ```
371
-
372
- ## With @faker-js/faker
373
-
374
- For more word variety, use the optional faker-js adapter:
375
-
376
- ```typescript
377
- import { TextGenerator, FakerJsAdapter } from 'marlarky';
378
- import { faker } from '@faker-js/faker';
379
-
380
- const generator = new TextGenerator({
381
- fakerAdapter: new FakerJsAdapter(faker),
382
- });
383
- ```
384
-
385
- `@faker-js/faker` is an optional peer dependency -- Marlarky works without it using the built-in `SimpleFakerAdapter`.
386
-
387
- ## Configuration
388
-
389
- Fine-tune generation behavior:
390
-
391
- ```typescript
392
- const generator = new TextGenerator({
393
- fakerAdapter: new SimpleFakerAdapter(),
394
- config: {
395
- minWordsPerSentence: 10,
396
- maxWordsPerSentence: 25,
397
- minSentencesPerParagraph: 3,
398
- maxSentencesPerParagraph: 6,
399
- questionRate: 0.05,
400
- compoundRate: 0.20,
401
- subordinateClauseRate: 0.15,
402
- maxPPChain: 2,
403
- maxAdjectivesPerNoun: 2,
404
- },
405
- });
406
- ```
407
-
408
- See the [usage guide](usage.md#configuration) for all configuration options.
409
-
410
- ## Tracing
411
-
412
- Enable trace mode to see how text was generated:
413
-
414
- ```typescript
415
- const generator = new TextGenerator({
416
- fakerAdapter: new SimpleFakerAdapter(),
417
- enableTrace: true,
418
- });
419
-
420
- const result = generator.sentence();
421
-
422
- console.log(result.text);
423
- // "The robust system efficiently processes data."
424
-
425
- console.log(result.trace.paragraphs[0].sentences[0].template);
426
- // "simpleDeclarative"
427
-
428
- console.log(result.trace.paragraphs[0].sentences[0].tokens);
429
- // [{ value: "The", source: "default" }, { value: "robust", source: "adj.business" }, ...]
430
- ```
431
-
432
- From the CLI, use `--trace` to send trace data to stderr, or `--json` to include it in structured stdout output.
433
-
434
- ## Examples
435
-
436
- ```bash
437
- # Run the basic usage example
438
- npm run example:basic
439
-
440
- # Run the corporate lexicon example
441
- npm run example:corporate
442
- ```
443
-
444
- ## Development
445
-
446
- ```bash
447
- # Install dependencies
448
- npm install
449
-
450
- # Build
451
- npm run build
452
-
453
- # Run tests (watch mode)
454
- npm test
455
-
456
- # Run tests once
457
- npm run test:run
458
-
459
- # Run tests with coverage
460
- npm run test:coverage
461
-
462
- # Lint
463
- npm run lint
464
- ```
465
-
466
- ## API Summary
467
-
468
- For the complete API reference including all types, interfaces, and configuration options, see the [usage guide](usage.md).
469
-
470
- | Method / Function | Description |
471
- | ----------------------------- | ---------------------------------------- |
472
- | `new TextGenerator(opts)` | Create a generator instance |
473
- | `generator.sentence(opts?)` | Generate one sentence |
474
- | `generator.paragraph(opts?)` | Generate a paragraph (2-7 sentences) |
475
- | `generator.textBlock(opts?)` | Generate multiple paragraphs |
476
- | `generator.setSeed(n)` | Set RNG seed for reproducibility |
477
- | `generator.setLexicon(lex)` | Load or replace a lexicon at runtime |
478
- | `generator.setArchetype(name)`| Activate a style preset |
479
- | `validateLexicon(obj)` | Validate a lexicon object |
480
- | `loadLexiconFromString(json)` | Parse a lexicon JSON string |
481
-
482
- ## License
483
-
484
- MIT
485
-
486
- ---
487
-
488
- _"Leveraging synergistic paradigms to facilitate robust deliverables across the ecosystem."_
489
- -- marlarky
1
+ # Marlarky
2
+
3
+ **Generate syntactically plausible English nonsense, steered by lexicons.**
4
+
5
+ Marlarky is a faker-like library and CLI that produces grammatically correct English text that sounds meaningful but isn't. Perfect for:
6
+
7
+ - Placeholder text generation (like Lorem Ipsum, but in English)
8
+ - Testing and mocking
9
+ - Creative writing prompts
10
+ - Procedural content generation
11
+ - Corporate buzzword bingo
12
+
13
+ ## Features
14
+
15
+ - **Syntactically correct** -- Proper grammar, subject-verb agreement, punctuation
16
+ - **Lexicon-driven** -- Guide output with custom vocabularies and style presets
17
+ - **Deterministic** -- Seedable RNG for reproducible output
18
+ - **Configurable** -- Control sentence types, lengths, complexity
19
+ - **Output transforms** -- Pipe text through built-in transforms (Pig Latin, leet speak, pirate, and more)
20
+ - **Traceable** -- Debug mode shows exactly how text was generated
21
+ - **Full CLI** -- Generate text, apply transforms, and validate lexicons from the command line
22
+ - **Zero dependencies** -- Works standalone or with @faker-js/faker
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ npm install marlarky
28
+ ```
29
+
30
+ ## Source Code & Issues
31
+
32
+ **Source**: https://github.com/JPaulDuncan/marlarky
33
+
34
+ **Issues**: https://github.com/JPaulDuncan/marlarky/issues
35
+
36
+ **Additional Usage**: https://jpaulduncan.github.io/marlarky/usage.md
37
+
38
+ **License**: MIT
39
+
40
+ ## Quick Start
41
+
42
+ ### TypeScript / JavaScript
43
+
44
+ ```typescript
45
+ import { TextGenerator, SimpleFakerAdapter } from 'marlarky';
46
+
47
+ const generator = new TextGenerator({
48
+ fakerAdapter: new SimpleFakerAdapter(),
49
+ });
50
+
51
+ generator.setSeed(42);
52
+
53
+ console.log(generator.sentence());
54
+ // "Generally, the change called."
55
+
56
+ console.log(generator.paragraph({ sentences: 3 }));
57
+ // Three sentences of plausible nonsense
58
+
59
+ console.log(generator.textBlock({ paragraphs: 2 }));
60
+ // Two paragraphs of corporate-sounding marlarky
61
+ ```
62
+
63
+ ### Command Line
64
+
65
+ ```bash
66
+ # Generate a sentence
67
+ marlarky sentence
68
+
69
+ # Generate a deterministic question
70
+ marlarky sentence --seed 42 --type question
71
+
72
+ # Generate a paragraph with a corporate lexicon
73
+ marlarky paragraph --sentences 5 --lexicon ./corp.json --archetype corporate
74
+
75
+ # Apply Pig Latin transform and output as JSON
76
+ marlarky sentence --seed 42 --transform pigLatin --json
77
+ ```
78
+
79
+ ## CLI
80
+
81
+ After installing globally (`npm install -g marlarky`) or locally, the `marlarky` command is available.
82
+
83
+ ### Commands
84
+
85
+ | Command | Description |
86
+ | ----------- | ------------------------------------------- |
87
+ | `sentence` | Generate one or more sentences |
88
+ | `paragraph` | Generate one or more paragraphs |
89
+ | `text` | Generate a text block (multiple paragraphs) |
90
+ | `validate` | Validate a lexicon JSON file |
91
+ | `list` | List available transforms or sentence types |
92
+
93
+ ### Global Options
94
+
95
+ These options work with `sentence`, `paragraph`, and `text`:
96
+
97
+ | Option | Short | Description |
98
+ | -------------------- | ----- | ------------------------------------------------------- |
99
+ | `--seed <n>` | `-s` | RNG seed for deterministic output |
100
+ | `--lexicon <path>` | `-l` | Path to a lexicon JSON file |
101
+ | `--archetype <name>` | `-a` | Archetype to activate from the lexicon |
102
+ | `--transform <id>` | `-x` | Apply an output transform (repeatable, comma-separated) |
103
+ | `--trace` | `-t` | Output JSON trace to stderr |
104
+ | `--json` | `-j` | Output full result as JSON to stdout |
105
+ | `--count <n>` | `-n` | Number of items to generate (default: 1) |
106
+ | `--help` | `-h` | Show help |
107
+ | `--version` | `-v` | Show version |
108
+
109
+ ### Generating Sentences
110
+
111
+ ```bash
112
+ # Random sentence
113
+ marlarky sentence
114
+
115
+ # Specific type
116
+ marlarky sentence --type question
117
+ marlarky sentence --type compound
118
+ marlarky sentence --type subordinate
119
+
120
+ # Control word count
121
+ marlarky sentence --min-words 10 --max-words 20
122
+
123
+ # Multiple sentences
124
+ marlarky sentence --count 5
125
+
126
+ # With hints (activate lexicon tags)
127
+ marlarky sentence --hints domain:tech,register:formal
128
+ ```
129
+
130
+ ### Generating Paragraphs
131
+
132
+ ```bash
133
+ # Random paragraph
134
+ marlarky paragraph
135
+
136
+ # Control sentence count
137
+ marlarky paragraph --sentences 5
138
+ marlarky paragraph --min-sentences 3 --max-sentences 8
139
+
140
+ # Multiple paragraphs
141
+ marlarky paragraph --count 3
142
+ ```
143
+
144
+ ### Generating Text Blocks
145
+
146
+ ```bash
147
+ # Random text block
148
+ marlarky text
149
+
150
+ # Control paragraph count
151
+ marlarky text --paragraphs 4
152
+ marlarky text --min-paragraphs 2 --max-paragraphs 6
153
+ ```
154
+
155
+ ### Applying Transforms
156
+
157
+ Use `--transform` (or `-x`) to pipe generated text through built-in transforms:
158
+
159
+ ```bash
160
+ # Pig Latin
161
+ marlarky sentence --seed 42 --transform pigLatin
162
+ # "Enerallygay, ethay angechay alledcay."
163
+
164
+ # Leet speak
165
+ marlarky sentence --seed 42 --transform leet
166
+
167
+ # Chain multiple transforms (comma-separated)
168
+ marlarky sentence --seed 42 --transform leet,uwu
169
+
170
+ # Or use repeated flags
171
+ marlarky sentence --seed 42 -x pirate -x mockCase
172
+ ```
173
+
174
+ Run `marlarky list transforms` to see all available transforms.
175
+
176
+ ### JSON Output
177
+
178
+ Use `--json` (or `-j`) to get structured output including metadata and trace:
179
+
180
+ ```bash
181
+ marlarky sentence --seed 42 --json
182
+ ```
183
+
184
+ ```json
185
+ {
186
+ "text": "Generally, the change called.",
187
+ "trace": { "...": "..." },
188
+ "meta": {
189
+ "archetype": "default",
190
+ "seed": 42
191
+ }
192
+ }
193
+ ```
194
+
195
+ ### Validating Lexicons
196
+
197
+ ```bash
198
+ # Human-readable output
199
+ marlarky validate ./my-lexicon.json
200
+
201
+ # Machine-readable JSON output
202
+ marlarky validate ./my-lexicon.json --json
203
+ ```
204
+
205
+ ### Listing Available Features
206
+
207
+ ```bash
208
+ # List all output transforms
209
+ marlarky list transforms
210
+
211
+ # List all sentence types
212
+ marlarky list types
213
+
214
+ # Output as JSON
215
+ marlarky list transforms --json
216
+ ```
217
+
218
+ ## Output Transforms
219
+
220
+ Marlarky includes 10 built-in output transforms that modify generated text at the token level. All transforms are deterministic (same seed = same output) and safe to chain.
221
+
222
+ | Transform | Description |
223
+ | -------------- | ------------------------------------- |
224
+ | `pigLatin` | Classic Pig Latin |
225
+ | `ubbiDubbi` | Ubbi Dubbi language game |
226
+ | `leet` | Leetspeak character substitution |
227
+ | `uwu` | Cute speak (w-substitution, suffixes) |
228
+ | `pirate` | Pirate speak |
229
+ | `redact` | Redact/mask words |
230
+ | `emoji` | Add emoji replacements |
231
+ | `mockCase` | rAnDoM cAsE aLtErNaTiOn |
232
+ | `reverseWords` | Reverse word order |
233
+ | `bizJargon` | Business jargon patterns |
234
+
235
+ ### Using Transforms in Code
236
+
237
+ ```typescript
238
+ const result = generator.sentence({
239
+ outputTransforms: {
240
+ enabled: true,
241
+ pipeline: [{ id: 'pigLatin' }],
242
+ },
243
+ });
244
+ ```
245
+
246
+ Transforms can also be configured at the lexicon level or per-archetype in your lexicon JSON. See the [usage guide](https://jpaulduncan.github.io/marlarky/usage.md) for details.
247
+
248
+ ## Sentence Types
249
+
250
+ Marlarky generates six sentence structures:
251
+
252
+ ```typescript
253
+ // Simple declarative: "The system processes data."
254
+ generator.sentence({ type: 'simpleDeclarative' });
255
+
256
+ // Question: "Does the team deliver results?"
257
+ generator.sentence({ type: 'question' });
258
+
259
+ // Compound: "The strategy evolved, and the metrics improved."
260
+ generator.sentence({ type: 'compound' });
261
+
262
+ // Subordinate clause: "Because the pipeline scales, the throughput increases."
263
+ generator.sentence({ type: 'subordinate' });
264
+
265
+ // Intro adverbial: "Furthermore, the initiative drives innovation."
266
+ generator.sentence({ type: 'introAdverbial' });
267
+
268
+ // Interjection: "Indeed, the team delivered results."
269
+ generator.sentence({ type: 'interjection' });
270
+ ```
271
+
272
+ ## Deterministic Output
273
+
274
+ Same seed produces the same text every time:
275
+
276
+ ```typescript
277
+ generator.setSeed(12345);
278
+ const a = generator.sentence();
279
+
280
+ generator.setSeed(12345);
281
+ const b = generator.sentence();
282
+
283
+ console.log(a === b); // true
284
+ ```
285
+
286
+ From the CLI:
287
+
288
+ ```bash
289
+ marlarky sentence --seed 12345
290
+ marlarky sentence --seed 12345
291
+ # Both print the same sentence
292
+ ```
293
+
294
+ ## Custom Lexicons
295
+
296
+ Create domain-specific marlarky with JSON lexicon files:
297
+
298
+ ```json
299
+ {
300
+ "id": "lexicon.startup",
301
+ "language": "en",
302
+ "termSets": {
303
+ "noun.startup": {
304
+ "pos": "noun",
305
+ "tags": ["domain:startup"],
306
+ "terms": [
307
+ { "value": "disruptor", "weight": 5 },
308
+ { "value": "unicorn", "weight": 3 },
309
+ { "value": "pivot", "weight": 4 },
310
+ { "value": "runway", "weight": 2 }
311
+ ]
312
+ },
313
+ "verb.startup": {
314
+ "pos": "verb",
315
+ "tags": ["domain:startup"],
316
+ "terms": [
317
+ { "value": "disrupt", "weight": 5 },
318
+ { "value": "scale", "weight": 4 },
319
+ { "value": "pivot", "weight": 3 },
320
+ { "value": "iterate", "weight": 3 }
321
+ ]
322
+ }
323
+ },
324
+ "archetypes": {
325
+ "startup": {
326
+ "tags": ["domain:startup"]
327
+ }
328
+ }
329
+ }
330
+ ```
331
+
332
+ Load it in code:
333
+
334
+ ```typescript
335
+ import {
336
+ TextGenerator,
337
+ SimpleFakerAdapter,
338
+ loadLexiconFromString,
339
+ } from 'marlarky';
340
+ import { readFileSync } from 'fs';
341
+
342
+ const lexicon = loadLexiconFromString(readFileSync('./startup.json', 'utf-8'));
343
+
344
+ const generator = new TextGenerator({
345
+ fakerAdapter: new SimpleFakerAdapter(),
346
+ lexicon,
347
+ });
348
+
349
+ generator.setArchetype('startup');
350
+ console.log(generator.paragraph());
351
+ ```
352
+
353
+ Or from the CLI:
354
+
355
+ ```bash
356
+ marlarky paragraph --lexicon ./startup.json --archetype startup
357
+ ```
358
+
359
+ See the [usage guide](usage.md#lexicon-schema) for the full lexicon schema reference.
360
+
361
+ ## Morphology Utilities
362
+
363
+ Marlarky exports standalone English morphology functions:
364
+
365
+ ```typescript
366
+ import {
367
+ pluralize,
368
+ singularize,
369
+ getPastTense,
370
+ getPresentParticiple,
371
+ getThirdPersonSingular,
372
+ getIndefiniteArticle,
373
+ } from 'marlarky';
374
+
375
+ pluralize('synergy'); // "synergies"
376
+ pluralize('child'); // "children"
377
+ singularize('stakeholders'); // "stakeholder"
378
+ getPastTense('leverage'); // "leveraged"
379
+ getPastTense('go'); // "went"
380
+ getPresentParticiple('run'); // "running"
381
+ getThirdPersonSingular('do'); // "does"
382
+ getIndefiniteArticle('hour'); // "an"
383
+ getIndefiniteArticle('user'); // "a"
384
+ ```
385
+
386
+ ## With @faker-js/faker
387
+
388
+ For more word variety, use the optional faker-js adapter:
389
+
390
+ ```typescript
391
+ import { TextGenerator, FakerJsAdapter } from 'marlarky';
392
+ import { faker } from '@faker-js/faker';
393
+
394
+ const generator = new TextGenerator({
395
+ fakerAdapter: new FakerJsAdapter(faker),
396
+ });
397
+ ```
398
+
399
+ `@faker-js/faker` is an optional peer dependency -- Marlarky works without it using the built-in `SimpleFakerAdapter`.
400
+
401
+ ## Configuration
402
+
403
+ Fine-tune generation behavior:
404
+
405
+ ```typescript
406
+ const generator = new TextGenerator({
407
+ fakerAdapter: new SimpleFakerAdapter(),
408
+ config: {
409
+ minWordsPerSentence: 10,
410
+ maxWordsPerSentence: 25,
411
+ minSentencesPerParagraph: 3,
412
+ maxSentencesPerParagraph: 6,
413
+ questionRate: 0.05,
414
+ compoundRate: 0.2,
415
+ subordinateClauseRate: 0.15,
416
+ maxPPChain: 2,
417
+ maxAdjectivesPerNoun: 2,
418
+ },
419
+ });
420
+ ```
421
+
422
+ See the [usage guide](usage.md#configuration) for all configuration options.
423
+
424
+ ## Tracing
425
+
426
+ Enable trace mode to see how text was generated:
427
+
428
+ ```typescript
429
+ const generator = new TextGenerator({
430
+ fakerAdapter: new SimpleFakerAdapter(),
431
+ enableTrace: true,
432
+ });
433
+
434
+ const result = generator.sentence();
435
+
436
+ console.log(result.text);
437
+ // "The robust system efficiently processes data."
438
+
439
+ console.log(result.trace.paragraphs[0].sentences[0].template);
440
+ // "simpleDeclarative"
441
+
442
+ console.log(result.trace.paragraphs[0].sentences[0].tokens);
443
+ // [{ value: "The", source: "default" }, { value: "robust", source: "adj.business" }, ...]
444
+ ```
445
+
446
+ From the CLI, use `--trace` to send trace data to stderr, or `--json` to include it in structured stdout output.
447
+
448
+ ## Examples
449
+
450
+ ```bash
451
+ # Run the basic usage example
452
+ npm run example:basic
453
+
454
+ # Run the corporate lexicon example
455
+ npm run example:corporate
456
+ ```
457
+
458
+ ## Development
459
+
460
+ ```bash
461
+ # Install dependencies
462
+ npm install
463
+
464
+ # Build
465
+ npm run build
466
+
467
+ # Run tests (watch mode)
468
+ npm test
469
+
470
+ # Run tests once
471
+ npm run test:run
472
+
473
+ # Run tests with coverage
474
+ npm run test:coverage
475
+
476
+ # Lint
477
+ npm run lint
478
+ ```
479
+
480
+ ## API Summary
481
+
482
+ For the complete API reference including all types, interfaces, and configuration options, see the [usage guide](usage.md).
483
+
484
+ | Method / Function | Description |
485
+ | ------------------------------ | ------------------------------------ |
486
+ | `new TextGenerator(opts)` | Create a generator instance |
487
+ | `generator.sentence(opts?)` | Generate one sentence |
488
+ | `generator.paragraph(opts?)` | Generate a paragraph (2-7 sentences) |
489
+ | `generator.textBlock(opts?)` | Generate multiple paragraphs |
490
+ | `generator.setSeed(n)` | Set RNG seed for reproducibility |
491
+ | `generator.setLexicon(lex)` | Load or replace a lexicon at runtime |
492
+ | `generator.setArchetype(name)` | Activate a style preset |
493
+ | `validateLexicon(obj)` | Validate a lexicon object |
494
+ | `loadLexiconFromString(json)` | Parse a lexicon JSON string |
495
+
496
+ ## License
497
+
498
+ MIT
499
+
500
+ ---
501
+
502
+ _"Leveraging synergistic paradigms to facilitate robust deliverables across the ecosystem."_
503
+ -- marlarky