# twaddle

> A never ending stream of nonsense using Markov chains and speaches of famous people

Latest version **1.1.2** (published 2016-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install twaddle
pnpm add twaddle
yarn add twaddle
bun add twaddle
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2016-05-30 |
| First published | 2016-05-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Matt Carter |
| Maintainers | hash-bang |
| Keywords | string, faker |

## Links

- npm: https://www.npmjs.com/package/twaddle
- Repository: https://github.com/hash-bang/twaddle
- Homepage: https://github.com/hash-bang/twaddle#readme
- Issues: https://github.com/hash-bang/twaddle/issues
- npm.io page: https://npm.io/package/twaddle

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.12.0
- [markoff](https://npm.io/package/markoff.md) ^2.2.0

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [whistle.savefor-mock](https://npm.io/package/whistle.savefor-mock.md) — 4 weekly downloads
- [typescript-types-mock](https://npm.io/package/typescript-types-mock.md) — 0 weekly downloads
- [mock-studio-mcp](https://npm.io/package/mock-studio-mcp.md) — 0 weekly downloads
- [@delon/mock](https://npm.io/package/@delon/mock.md) — 0 weekly downloads

## Recent versions

- 1.1.2 (latest) — 2016-05-30
- 1.1.1 — 2016-05-16
- 1.1.0 — 2016-05-14
- 0.0.0 — 2016-05-14

## README

Twaddle
=======
A never ending stream of nonsense using Markov chains and speeches of famous people.

This module is an extension to the excellent [Markoff](https://github.com/jcorbin/markoff) module, that comes pre-packaged with data to quickly generate filler text from profiles of various speeches.



Using a supplied data pack
--------------------------
See the [data](./data) directory for a full list of what data comes supplied with this module.

```javascript
var twaddle = require('twaddle');

console.log( twaddle.generate('politics-us-kennedy-f-john', {sentences: 1}) ); // Ask not what your country...
```


Combining data packs
--------------------
You can also supply `twaddle.generate()` with an array of ID's which will merge these data packs together:

```javascript
var twaddle = require('twaddle');

console.log( twaddle.generate(['politics-us-trump-j-donald', 'politics-de-hitler-adolph'], {paragraphs: 5}) );
```


Using your own data
-------------------

```javascript
var twaddle = require('twaddle');

twaddle.register('lincoln', __dirname + '/test/data/gettysburg.txt'))

console.log( twaddle.generate({words: 10}) ); // Four score and eleven...
```


See the [test](./test) directory for more complex examples.


API
===

twaddle.register(id, path)
--------------------------
Register a file of text against the ID to use later


twaddle.compile(id)
-------------------
Compile the given ID into a chain. This is done automatically if `generate(id)` is called without the chain being present.


twaddle.generate([options={words:20}])
--------------------------------------
Generate the specified amount of text.

The options parameter can be constructed of the following keys:

| Key                        | Default     | Description                                                                                                             |
|----------------------------|-------------|-------------------------------------------------------------------------------------------------------------------------|
| `words`                    | `20`        | Generate at minimum this number of words                                                                                |
| `sentences`                | `null`      | Generate at minimum this number of sentences                                                                            |
| `paragraphs`               | `null`      | Generate at minimum this number of paragraphs (this can override `sentences` to produce its output                      |
| `minSentencesPerParagraph` | `1`         | The smallest number of sentences that can constitute a paragraph                                                        |
| `maxSentencesPerParagraph` | `5`         | The largest number of sentences that can constitute a paragraph                                                         |
| `paragraphJoiner`          | `"\n\n"`    | The joining characters used between paragraphs                                                                          |
| `paragraphStructure`       | `[]`        | An array of the sentence length of each paragraph. If omitted this is calculated and randomized from the above settings |
| `fixTrim`                  | `true`      | Trim all paragraph content before output                                                                                |
| `fixCapitalFirst`          | `true`      | Check that all sentences have a capital letter first                                                                    |


Credits
=======
* [American Rhetoric](http://www.americanrhetoric.com)
* [History Place](http://www.historyplace.com/speeches/previous.htm)
* [Jewish Virtual Library](http://www.jewishvirtuallibrary.org/jsource/Holocaust/hitlertoc.html)
* [Presidential Rhetoric](http://www.presidentialrhetoric.com/historicspeeches/index.html)

---
_Source: https://npm.io/package/twaddle · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
