npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

twaddle

v1.1.2

Published

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

Downloads

29

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 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 directory for a full list of what data comes supplied with this module.

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:

var twaddle = require('twaddle');

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

Using your own data

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 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