git @ Cat's Eye Technologies Chainscape / the-chainscape-writeup
the-chainscape-writeup

Tree @the-chainscape-writeup (Download .tar.gz)

Chainscape

An exploration of the algebraic properties of Markov Chains, for NaNoGenMo 2023.

Exciting algebraic discoveries

Watch this space. In the meantime, you can read this issue.

Instructions for generating novel

(bash or similar shell on Ubuntu 20.04 or similar system)

git clone https://codeberg.org/catseye/T-Rext
cd T-Rext
git fetch origin
git checkout 0.4
cd ..

git clone https://codeberg.org/catseye/Chainscape
cd Chainscape
virtualenv --python=python3.9 venv
source venv/bin/activate
python3 --version   # Python 3.9.16
pip install -r requirements.txt
mkdir corpus
for N in 11 16 45 55 98 345 768 2701 5921 64317; do
    wget "https://gutenberg.org/cache/epub/$N/pg$N-images.html" -O "corpus/$N.html"
    python3 src/extract-tokenstream.py "corpus/$N.html" > "corpus/$N.txt"
    sleep 10
done

echo "The Other and the Same" >novel.md
echo "======================" >>novel.md
python3 src/transition-matrix.py intersect corpus/*.txt --seed 50000 --count 69972 | ../T-Rext/bin/t-rext - >>novel.md
wc -w novel.md   # 50250 novel.md
export HTML="The Other and the Same.html"
echo '<!DOCTYPE html>' >"$HTML"
echo '<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>' >>"$HTML"
markdown_py -o html < novel.md >>"$HTML"