~nytpu/markov-bot

Markov chain text generator from a Mastodon post dump
decode &
fuck you
Revert "fix fuckery"

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~nytpu/markov-bot
read/write
git@git.sr.ht:~nytpu/markov-bot

You can also use your local clone with git send-email.

#Markov Bot

license: AGPL-3.0-only

Markov chain generator. Has a generic Markov chain implementation (src/markov.lisp) and a small wrapper script designed to make importing from a Mastodon-Archive convenient.

#Building

#Requirements

#Compiling

First, clone the repo:

git clone https://git.sr.ht/~nytpu/markov-bot

Markov Bot can be built (and tested) with or without using Qlot.

If using Qlot then you must run this to install all dependencies locally:

qlot install

If Qlot is not installed, then it'll fall back to Quicklisp for downloading dependencies. If Quicklisp is not available, it falls back to attempting to directly load dependencies using ASDF.

Then, run:

./build.sh [context size] [input file]

context size is the number of tokens (approximating words and whitespace & punctuation characters) to use as context when predicting future tokens. What value to use depends on the amount and length of the input values.

input file is the input file to read a JSON array containing sample strings from. - indicates stdin. HTML tags and @-style username mentions will be stripped from input strings.

After building, a markov-bot executable will be placed in the root directory that will print a generated message to stdout when invoked.

See ./build.sh -h for additional build options.

Here's a sample invocation using jq to import posts from a post dump downloaded using Mastodon-Archive with a context of 4:

jq '[.statuses.[] | select(.reblog == null and .visibility != "direct" and .content != "") | .content]' \
	~/Documents/Fediverse/tilde.zone.user.nytpu.json |
	./build.sh 4 -

The JQ command filters posts to only include posts that aren't boosts/quote boosts, aren't direct messages, and don't have an empty body, generates a JSON array containing only the selected posts content, and then pipes it to the build script.

#Contributing

The upstream URL of this project is https://git.sr.ht/~nytpu/markov-bot. Send suggestions, bugs, patches, and other contributions to alex@nytpu.com or ~nytpu/public-inbox@lists.sr.ht. For help sending a patch through email, see https://git-send-email.io.

If you aren't comfortable sending a patch through email, get in touch with a link to your repo and I'll pull the changes down myself!

Copyright (C) 2024 nytpu <alex [at] nytpu.com>.

Licensed under the terms of the GNU Affero General Public License, version 3. You can view a copy of the GNU AGPL in licenses/LICENSE or at https://www.gnu.org/licenses/agpl-3.0.html.

Please view COPYING for a full copyright statement of the project and all dependencies.