You call that science? That's not science, THIS is science!
Chris Pressey
10 years ago
0 | 0 |
levenshtein-equidistant
|
1 | 1 |
=======================
|
2 | 2 |
|
3 | |
Requirements
|
4 | |
------------
|
|
3 |
Hypothesis
|
|
4 |
----------
|
|
5 |
|
|
6 |
I expect that if I carry out this experiment, I will discover that I was
|
|
7 |
not quite sure what I was expecting.
|
|
8 |
|
|
9 |
Apparatus
|
|
10 |
---------
|
5 | 11 |
|
6 | 12 |
* Python 2.7.6 (probably works with older versions too)
|
7 | 13 |
* [py-editdist](http://www.mindrot.org/projects/py-editdist/)
|
8 | 14 |
* Two or three input texts
|
9 | 15 |
|
10 | |
Basic Strategy
|
11 | |
--------------
|
|
16 |
Method
|
|
17 |
------
|
12 | 18 |
|
13 | 19 |
* Input two reference texts. Then either input a "seed text", or
|
14 | 20 |
generate a random string of characters and use that as the seed text.
|
0 | 0 |
narrative-makefile
|
1 | 1 |
==================
|
2 | 2 |
|
3 | |
Requirements
|
4 | |
------------
|
|
3 |
Hypothesis
|
|
4 |
----------
|
|
5 |
|
|
6 |
We can generate a story using only `make`.
|
|
7 |
|
|
8 |
Apparatus
|
|
9 |
---------
|
5 | 10 |
|
6 | 11 |
* GNU Make (other makes might work too)
|
7 | 12 |
|
8 | |
Basic Strategy
|
9 | |
--------------
|
|
13 |
Method
|
|
14 |
------
|
10 | 15 |
|
11 | 16 |
* Each point in the narrative is a goal, and may require other goals to
|
12 | 17 |
be met, before it can be met.
|
13 | 18 |
* Each goal outputs some text as a side-effect.
|
14 | 19 |
|
15 | |
Sample Output
|
16 | |
-------------
|
|
20 |
Observations
|
|
21 |
------------
|
17 | 22 |
|
18 | 23 |
$ make
|
19 | 24 |
Once upon a time there was a brave knight.
|
0 | 0 |
poetic-inventory
|
1 | 1 |
================
|
2 | 2 |
|
3 | |
Requirements
|
4 | |
------------
|
|
3 |
Hypothesis
|
|
4 |
----------
|
|
5 |
|
|
6 |
We hypothesize that it is possible to extract phrases from public-domain novels
|
|
7 |
and alphabetize them. Well, I suppose we also hypothesize that, with enough
|
|
8 |
input texts, the final result may look like an interesting inventory of things.
|
|
9 |
|
|
10 |
Apparatus
|
|
11 |
---------
|
5 | 12 |
|
6 | 13 |
* Python 2.7.6 (probably works with older versions too)
|
7 | 14 |
* The `gutenberg.py` module from [gutenizer](https://github.com/okfn/gutenizer/)
|
8 | 15 |
* A bunch of Project Gutenberg texts in plain text format
|
9 | 16 |
|
10 | |
Basic Strategy
|
11 | |
--------------
|
|
17 |
Method
|
|
18 |
------
|
12 | 19 |
|
13 | 20 |
* Find all phrases which are neither "beginners" nor "enders" in the sense
|
14 | 21 |
of [join-at-pivot](../join-at-pivot/).
|
|
17 | 24 |
* Dump out those phrases, capitalizing the first word and replacing each
|
18 | 25 |
semicolon with a full stop and a paragraph break.
|
19 | 26 |
|
20 | |
Sample Output
|
21 | |
-------------
|
|
27 |
Observations
|
|
28 |
------------
|
|
29 |
|
|
30 |
(The list of input texts that produced this TBA.)
|
22 | 31 |
|
23 | 32 |
> A 5.9, a Believer, a Bible, a Biscay lady on her way to Seville, a Biscayan, a Blackbird, a Bonanza King, a Bricklayer passed by, a British aëroplane, a Carabineer* happened along, a Castilian, a Castilian, a Cervantes Saavedra, a Cheese Committee to consist of seven members of the Exchange, a Cheese Inspector and also a Deputy Inspector, a Chicago millionaire, a Chinaman, a Chinese body-servant, a Christian, a Colonial trader, a Crow, a Curious Thing.
|
24 | 33 |
>
|
0 | 0 |
pyramidal-reduction
|
1 | 1 |
===================
|
2 | 2 |
|
3 | |
Requirements
|
4 | |
------------
|
|
3 |
Hypothesis
|
|
4 |
----------
|
|
5 |
|
|
6 |
Can we transform a text by building rewriting rules for it on-the-fly?
|
|
7 |
|
|
8 |
Apparatus
|
|
9 |
---------
|
5 | 10 |
|
6 | 11 |
* Python 2.7.6 (probably works with older versions too)
|
7 | 12 |
* An input sentence
|
8 | 13 |
|
9 | |
Basic Strategy
|
10 | |
--------------
|
|
14 |
Method
|
|
15 |
------
|
11 | 16 |
|
12 | 17 |
* For each pair of symbols in the input sentence, use a rule to reduce
|
13 | 18 |
them to a single symbol. This results in a sentence which is one
|
0 | 0 |
reluctance-generator
|
1 | 1 |
====================
|
2 | 2 |
|
3 | |
Requirements
|
4 | |
------------
|
|
3 |
Hypothesis
|
|
4 |
----------
|
|
5 |
|
|
6 |
We hypothesize that it is possible to make a computer sound reluctant.
|
|
7 |
|
|
8 |
Apparatus
|
|
9 |
---------
|
5 | 10 |
|
6 | 11 |
* Python 2.7.6 (probably works with older versions too)
|
7 | 12 |
|
8 | |
Basic Strategy
|
9 | |
--------------
|
|
13 |
Method
|
|
14 |
------
|
10 | 15 |
|
11 | 16 |
* Use a "recursive descent generator" to generate statements suggesting
|
12 | 17 |
reluctance. This is like a recursive descent parser, but run "in reverse."
|
|
17 | 22 |
it will not mind at all creating sentences after which a linguist would
|
18 | 23 |
be inclined to put an asterisk.
|
19 | 24 |
|
20 | |
Sample Output
|
21 | |
-------------
|
|
25 |
Observations
|
|
26 |
------------
|
22 | 27 |
|
23 | 28 |
$ ./reluctance-generator.py
|
24 | 29 |
I don't think .
|
0 | 0 |
shanty-generator
|
1 | 1 |
================
|
2 | 2 |
|
3 | |
Requirements
|
4 | |
------------
|
|
3 |
Hypothesis
|
|
4 |
----------
|
|
5 |
|
|
6 |
We hypothesize that we can get a computer to generate sea shanties, or at
|
|
7 |
least texts which are somewhat shanty-like.
|
|
8 |
|
|
9 |
Apparatus
|
|
10 |
---------
|
5 | 11 |
|
6 | 12 |
* Python 2.7.6 (probably works with older versions too)
|
7 | 13 |
* Some input text
|
8 | 14 |
|
9 | |
Basic Strategy
|
10 | |
--------------
|
|
15 |
Method
|
|
16 |
------
|
11 | 17 |
|
12 | 18 |
* Pick one of a number of templates.
|
13 | 19 |
* The template will require _n_ words. Consume _n_ words from the input.
|
14 | 20 |
* Replace the variables in the template with the words.
|
15 | 21 |
* Repeat until no more (or not enough more) words available in the input.
|
16 | 22 |
|
17 | |
Notes
|
18 | |
-----
|
|
23 |
It should be noted that the method described here is by no means specific
|
|
24 |
to shanties.
|
19 | 25 |
|
20 | |
The procedure above is not specific, by any means, to shanties. But that
|
21 | |
is what we will try to generate here.
|
22 | |
|
23 | |
Sample Output
|
24 | |
-------------
|
|
26 |
Observations
|
|
27 |
------------
|
25 | 28 |
|
26 | 29 |
$ ./shanty-generator.py It was the best of times it was the worst of times
|
27 | 30 |
It, was-was,
|