Markovian Parallax Generate: On digital writing and poetics

Mchain 0.2 Script – Download and Usage

Installing Python on your System

If you are a Linux user, it is very likely that you have python installed. If you are a Mac user with OS X v. 10.3 or newer, python is also already installed, so don’t worry about this part. Othewise, read this page.

In general, the first thing you need to do before you can use this script is install the Python programming environment. Go to the download page on the Python website and find the installer for your platform (Windows, Mac, or Linux). Follow the instructions that come with the installer, or go to the instructional links lower down on their page.

For Windows users, you may also have to tell Windows where the python interpreter is located. By default all of the files for Python 2.5 install to c:\Python25\. The instructions for this process (among other issues) are covered in greater detail here. If you find that you still are having problems running the script, then you may have to make the .py file executable. That is also covered in the same tutorial as above.

Download the Script

You can view the source code for the script, mchain.py, here.

To download it, click on the link here and follow the instructions below: download mchain.py

Unzip the archive you have downloaded. Create a folder to put the script (mchain.py) into that is easily accessible, and easy to type into the terminal or command prompt; I suggest c:\mchain for Windows users, and ~/mchain for Linux. Do something similar for Mac: place the folder in a base user directory. You will be entering it every time you use the script and, as I suggest later on in the instructions, you should put all of the files that you are using for input and output into this folder as well. It makes things so much easier.

There is no installation for the script. It uses the Python interpreter you have installed on your system to do everything.

Running the Script

The instructions and guides on running the mchain script are below. Choose the link below that corresponds with your computer’s operating system platform.

Running Mchain in Linux

Some First Things

The program only runs from a terminal window. There is no GUI for it yet. If you are unfamiliar with using the terminal, there is a great guide here that covers more than you will need to run the script.

Note: The cd and ls commands are all you should need to get going. You can also highlight files listed by the ls command with your mouse and use the central button to paste, or hit ctrl+v on the keyboard.

Remember that you must be in the directory with the mchain.py script to execute it. You must be in this directory, or you will not be able to run the program according to the examples below. Otherwise the terminal will keep returning errors.

You must also make sure that the script has been given permissions to execute as a program. This is most easily done by entering your favorite file browser, right-clicking on the mchain.py file, entering the file properties, and finding the permissions tab. There should be a box to check to give the script this permission to execute as a program.

Lastly, the script will only handle plain text files as input (.text, or .txt). Files with .rtf, .doc, .htm, etc. as extensions cannot be read properly by the script.

Program Commands and Usage

To run the script, you need to pass it the following commands in the terminal:

./mchain.py -k [keylength - a number of 1 or more] -n [output chain length - a number of your desire] -o [output file] [input file(s) seperated by a space if multiple input files]

One great thing about using the script in Linux and Mac OS X is that the -o command is optional. The program will print to the screen, and then you can highlight what phrases or sections you like, copy them, and paste them into a text editor.

Some Notes on my Examples Before You Get Started:

The numbers that I give below for the -k and -n commands are only guidelines. Feel free to experiment with different values to suit your own needs and preferences. At some point I will have the script’s programmer discuss how it works and what each value means, so you may better understand what changes in your Markov chains as you tweak with these commands (the -k command in particular).

Example

Here is an example of what you would type to create a Markov chain with a keylength of 1 and a chain length of 300 iterations, with mobydick.txt as input file and no output file ( the program will by default print the output to screen):

./mchain.py -k 1 -n 300 mobydick.txt

Important Notes: Remember that all input files must be in plain text format. In Linux, you do not need to give plain text files an extension, but I find it helpful to give them one of .txt or .text for the sake of convenience.

All files should be in the same directory as the script, too, as this simplifies the commands you have to give the program. My examples follow from this arrangement. Otherwise, you must give the full paths to the files that you want to use as input or output.

The output should look something like this:

“And he stood apart; one, with various silent stillness of their appearance, caused him by birth or more wouldst but clean, comely looking back into furious with it. Say he will read to-morrow noon; and abhorring, landed the fatal missive from the scuttle a hundred years, repenting prophet and vials, though–to the Parsee by hook just beneath the riveted upon all appearances, the water–Daggoo, through this our pains of the splintered helmet of a whale, each of spouts, lowered a man should say that the loggerhead there, and pile on here and in him; and more makes one of yonder undetected villain’s marble trunk of a great work very interesting one, very ancient Dutch savage, owning about it, and unreliable–they live blood gushing from the Ram–lecherous dog, he begets us; and snapped, Ahab, and Tashtego was now over him, then slightly altered, and welded sinews; but gave place Jonah sees no external difference between the water, he was to a snow-white charger; and more than though the seamen rushed for the eastward, the London edition of a long slender mandible of the rest of them, one side, darted from him; aye, Starbuck, who have it.
But just buttoning the visiting our Western annals and the seamen as an untravelled American, than pulling hand-over-hand upon them, he must do not seen through it tossed shuttlecock to Queequeg, I came towards the ship free; “look here; how Ahab unmindful of the error-abounding log? and a brazen lamp.
“To fifty years before him; but the vindictive sort of water there.
But not what he too many cases, this noteworthy difference between his wigwam keeping his orders for him a napkin should be so curious articles, word HE.
The schooner moored by casualties in the curving icicles depended from the

Example with multiple input texts:

If you want to have more than one input text, this is how you would add the multiple texts:

./mchain.py -k 1 -n 300 TEXT1.txt TEXT2.txt TEXT3.txt

and so on.

Example with the -o option

Here’s an example now that is the same as the first example, except that a file named mobyout.txt has been set as the output file. The output file does not need to be created before you run the command; it will be created in the directory that you are running the script in automatically:

./mchain.py -k 1 -n 300 -o mobyout.txt mobydick.txt

If you open mobyout.txt, you’ll see the same kind of output has been placed there instead of being printed to the terminal screen:

That’s the world; put up towards home, and the Long seasoned with regard to be made a castor of our old craft in the world, and have never see the command of all this, too, stands with these there are you to the streets of her suburban avenues of unrecorded, in its cunning peculiar tones when the book treated of the knightly days after sport.
“Strike the redeemed, and from the end the true child again.–Oh Mary! Mary!–boy! boy! I do anything but nevertheless it has the schoolmaster to exhort him by them never figured in its drippings, that take it with the ship’s company were then shall record years afterwards, when most malicious assaults!
Ere
Be cool milkiness; in the ringed horizon when he was put to be bedfellows. I don’t budge. Cruppered with great lips for their back a terrible duels among the hunted by old fairy tales of brit, which, if possible, Ahab did such reports as the clumsy cleat, as he did you call of sailing, $20,000,000! and picked up amid the hinder part of the mizen shrouds, he held by me, do they said Flask. “Yes, when the deck. How being assigned to the lee of them ahead, boy, nor can in their vocation, the thousandth part of families from the devil could have me–let’s see–how many minor contingencies, all glorious thing is then such a word, so gloomy-jolly.
At first person placed over her course.”
The Albatross.
CHAPTER 128
“Get the morning, turning to drive the whale in fat kine; in the whale, watching to that sea, on board the world at once complied, and her reverend clergy–am a Right Whale have a foreboding shivers ran him down with your tears the same room light come those

That’s all there is to it. Enjoy! Please email me (mindlesswonder-admin@bluebottle.com) or leave a comment below if you encounter any errors (and also if you found any way to fix those errors that I may want to add to these instructions).

Running Mchain in Mac OS X

Some First Things

The program only runs from a terminal window. There is no GUI for it yet. If you are unfamiliar with using the terminal, there is are some basic guides here and here that cover all that you will need to know to run the script. The guide for Linux terminal commands here might be useful to you as well, as the commands are for the most part the same in Mac OS X.

Note: The cd and ls commands are all you should need to get going. You can also highlight files listed by the ls command with your mouse and use the central button to paste, or hit ctrl+v on the keyboard.

Remember that you must be in the directory with the mchain.py script to execute it. You must be in this directory, or you will not be able to run the program according to the examples below. Otherwise the terminal will keep returning errors.

You must also make sure that the script has been given permissions to execute as a program. This is most easily done by entering your favorite file browser, right-clicking on the mchain.py file, entering the file properties, and finding the permissions tab. There should be a box to check to give the script this permission to execute as a program.

Lastly, the script will only handle plain text files as input (.text, or .txt). Files with .rtf, .doc, .htm, etc. as extensions cannot be read properly by the script.

Program Commands and Usage

To run the script, you need to pass it the following commands in the terminal:

./mchain.py -k [keylength - a number of 1 or more] -n [output chain length - a number of your desire] -o [output file] [input file(s) seperated by a space if multiple input files]

One great thing about using the script in Linux and Mac OS X is that the -o command is optional. The program will print to the screen, and then you can highlight what phrases or sections you like, copy them, and paste them into a text editor.

Some Notes on my Examples Before You Get Started:

The numbers that I give below for the -k and -n commands are only guidelines. Feel free to experiment with different values to suit your own needs and preferences. At some point I will have the script’s programmer discuss how it works and what each value means, so you may better understand what changes in your Markov chains as you tweak with these commands (the -k command in particular).

Example

Here is an example of what you would type to create a Markov chain with a keylength of 1 and a chain length of 300 iterations, with mobydick.txt as input file and no output file ( the program will by default print the output to screen):

./mchain.py -k 1 -n 300 mobydick.txt

Important Notes: Remember that all input files must be in plain text format. In Linux, you do not need to give plain text files an extension, but I find it helpful to give them one of .txt or .text for the sake of convenience.

All files should be in the same directory as the script, too, as this simplifies the commands you have to give the program. My examples follow from this arrangement. Otherwise, you must give the full paths to the files that you want to use as input or output.

The output should look something like this:

“And he stood apart; one, with various silent stillness of their appearance, caused him by birth or more wouldst but clean, comely looking back into furious with it. Say he will read to-morrow noon; and abhorring, landed the fatal missive from the scuttle a hundred years, repenting prophet and vials, though–to the Parsee by hook just beneath the riveted upon all appearances, the water–Daggoo, through this our pains of the splintered helmet of a whale, each of spouts, lowered a man should say that the loggerhead there, and pile on here and in him; and more makes one of yonder undetected villain’s marble trunk of a great work very interesting one, very ancient Dutch savage, owning about it, and unreliable–they live blood gushing from the Ram–lecherous dog, he begets us; and snapped, Ahab, and Tashtego was now over him, then slightly altered, and welded sinews; but gave place Jonah sees no external difference between the water, he was to a snow-white charger; and more than though the seamen rushed for the eastward, the London edition of a long slender mandible of the rest of them, one side, darted from him; aye, Starbuck, who have it.
But just buttoning the visiting our Western annals and the seamen as an untravelled American, than pulling hand-over-hand upon them, he must do not seen through it tossed shuttlecock to Queequeg, I came towards the ship free; “look here; how Ahab unmindful of the error-abounding log? and a brazen lamp.
“To fifty years before him; but the vindictive sort of water there.
But not what he too many cases, this noteworthy difference between his wigwam keeping his orders for him a napkin should be so curious articles, word HE.
The schooner moored by casualties in the curving icicles depended from the

Example with multiple input texts:

If you want to have more than one input text, this is how you would add the multiple texts:

./mchain.py -k 1 -n 300 TEXT1.txt TEXT2.txt TEXT3.txt

and so on.

Example with the -o option

Here’s an example now that is the same as the first example, except that a file named mobyout.txt has been set as the output file. The output file does not need to be created before you run the command; it will be created in the directory that you are running the script in automatically:

./mchain.py -k 1 -n 300 -o mobyout.txt mobydick.txt

If you open mobyout.txt, you’ll see the same kind of output has been placed there instead of being printed to the terminal screen:

That’s the world; put up towards home, and the Long seasoned with regard to be made a castor of our old craft in the world, and have never see the command of all this, too, stands with these there are you to the streets of her suburban avenues of unrecorded, in its cunning peculiar tones when the book treated of the knightly days after sport.
“Strike the redeemed, and from the end the true child again.–Oh Mary! Mary!–boy! boy! I do anything but nevertheless it has the schoolmaster to exhort him by them never figured in its drippings, that take it with the ship’s company were then shall record years afterwards, when most malicious assaults!
Ere
Be cool milkiness; in the ringed horizon when he was put to be bedfellows. I don’t budge. Cruppered with great lips for their back a terrible duels among the hunted by old fairy tales of brit, which, if possible, Ahab did such reports as the clumsy cleat, as he did you call of sailing, $20,000,000! and picked up amid the hinder part of the mizen shrouds, he held by me, do they said Flask. “Yes, when the deck. How being assigned to the lee of them ahead, boy, nor can in their vocation, the thousandth part of families from the devil could have me–let’s see–how many minor contingencies, all glorious thing is then such a word, so gloomy-jolly.
At first person placed over her course.”
The Albatross.
CHAPTER 128
“Get the morning, turning to drive the whale in fat kine; in the whale, watching to that sea, on board the world at once complied, and her reverend clergy–am a Right Whale have a foreboding shivers ran him down with your tears the same room light come those

That’s all there is to it. Enjoy! Please email me (escovel@gmail.com) or leave a comment below if you encounter any errors (and also if you found any way to fix those errors that I may want to add to these instructions).

Running Mchain in Windows

Some First Things

The script only runs from the command prompt. There is no GUI for it yet. If you are unfamiliar with using the command prompt, there is a great guide here that covers everything you will need to run the script and then some.

Note: The cd and dir commands are all you should need to get going.

Remember that you must be in the directory with the mchain.py script to execute it. You must be in this directory, or you will not be able to run the program according to the examples below. Otherwise the script will keep returning errors.

You must also make sure that the script has been given permissions to execute as a program. A tutorial for doing this in Windows has already been linked to in the Installing Python section at the top of this page.

Lastly, the script will only handle plain text files as input (.text, or .txt). Files with .rtf, .doc, .htm, etc. as extensions cannot be read properly by the script.

Program Commands and Usage

To run the script from the command prompt, you need to pass it the following commands:

python mchain.py -k [keylength - a number of 1 or more] -n [output chain length - a number of your desire] -o [output file] [input file(s) separated by a space if multiple input files]

In Windows, the -o command in not optional. The Windows command prompt does not print the program output to screen by default, and I don’t know how to make it do so. You need to us the -o command to give the program a text file to put the output in.

Some Notes on my Examples Before You Get Started:

The numbers that I give below for the -k and -n commands are only guidelines. Feel free to experiment with different values to suit your own needs and preferences. At some point I will have the script’s programmer discuss how it works and what each value means, so you may better understand what changes in your Markov chains as you tweak with these commands (the -k command in particular).

Example

Here is an example of what you would type to create a Markov chain with a keylength (-k) of 1 and a chain length (-n) of 300 iterations, with mobyout.txt as the output file and mobydick.txt as the input file:

python mchain.py -k 1 -n 300 -o mobyout.txt mobydick.txt

Important Notes: All input files must be in plain text format.

Also, the output file does not need to be created before you run the command; it will be created in the directory that you are running the program automatically. Make sure, whatever you do name it, that it has a .txt extension.

All files should be in the same directory as the script, too, as this simplifies the commands you have to give the program. My examples follow from this arrangement. Otherwise, you must give the full paths to the files that you want to use as input or output.

If you open mobyout.txt, you’ll see the program output has been placed there. It should look something like this:

That’s the world; put up towards home, and the Long seasoned with regard to be made a castor of our old craft in the world, and have never see the command of all this, too, stands with these there are you to the streets of her suburban avenues of unrecorded, in its cunning peculiar tones when the book treated of the knightly days after sport.
“Strike the redeemed, and from the end the true child again.–Oh Mary! Mary!–boy! boy! I do anything but nevertheless it has the schoolmaster to exhort him by them never figured in its drippings, that take it with the ship’s company were then shall record years afterwards, when most malicious assaults!
Ere
Be cool milkiness; in the ringed horizon when he was put to be bedfellows. I don’t budge. Cruppered with great lips for their back a terrible duels among the hunted by old fairy tales of brit, which, if possible, Ahab did such reports as the clumsy cleat, as he did you call of sailing, $20,000,000! and picked up amid the hinder part of the mizen shrouds, he held by me, do they said Flask. “Yes, when the deck. How being assigned to the lee of them ahead, boy, nor can in their vocation, the thousandth part of families from the devil could have me–let’s see–how many minor contingencies, all glorious thing is then such a word, so gloomy-jolly.
At first person placed over her course.”
The Albatross.
CHAPTER 128
“Get the morning, turning to drive the whale in fat kine; in the whale, watching to that sea, on board the world at once complied, and her reverend clergy–am a Right Whale have a foreboding shivers ran him down with your tears the same room light come those

Example with multiple input texts:

If you want to have more than one input text, this is how you would add the multiple texts:

python mchain.py -k 1 -n 300 -o output.txt input1.txt input2.txt input3.txt (and so on, as many as you like.)

That’s all there is to it. Have fun! Please email me (escovel@gmail.com) or leave a comment below if you encounter any errors (and also if you found any way to fix those errors that I may want to add to these instructions).

3 Responses

Subscribe to comments with RSS.

  1. [...] Mchain 0.2 Script – Download and Usage [UPDATED] [...]

  2. [...] 0.2 (Python script) download and installation [...]

  3. minecraft cracked said, on July 21, 2013 at 5:52 am

    If you want a Premium Minecraft Account check out this generator.
    With it you can generate a unique Minecraft Premium Account which no one else has!
    You can Download the Free Premium Minecraft Account Generator http://MINECRAFTFREEDL.
    TK

    It’s really a cool and helpful piece of information. I am happy that you shared this useful info with us. Please stay us informed like this. Thanks for sharing.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: