From d08f1f94ec79728964f0b3e96497c2fac2e0d3c6 Mon Sep 17 00:00:00 2001 From: smitten Date: Thu, 20 Jul 2023 00:24:18 -0400 Subject: [PATCH] Update docs --- README.md | 15 +++++++++------ generators/markov.py | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bcb07f0..47d7bcf 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,15 @@ # pleroma-ebooks -this is a very slightly modified version of -current changes: removes any generated @'s in replies to prevent accidentally mentioning somebody else on the same instance +this is a very slightly modified version of which is modified from + +_autumn's changes_: removes any generated @'s in replies to prevent accidentally mentioning somebody else on the same instance + +_smitten's changes_: adjusts CW filtering to be word-based regexp instead of exact match It's like [@AgathaSorceress's mstdn-ebooks] but it supports Pleroma better. [@AgathaSorceress's mstdn-ebooks]: https://github.com/AgathaSorceress/mstdn-ebooks -## Secure Fetch -Secure fetch (aka authorised fetches, authenticated fetches, secure mode...) is *not* supported by pleroma-ebooks, and will fail to download any posts from users on instances with secure fetch enabled. For more information, see [this wiki page](https://github.com/Lynnesbian/mstdn-ebooks/wiki/Secure-fetch). - - ## How to Use 1. Create your bot account on the server. 2. Follow the user(s) you want to base the model on. @@ -18,6 +17,10 @@ Secure fetch (aka authorised fetches, authenticated fetches, secure mode...) is 4. Copy `config.defaults.json` to `config.json` and set as `access_token`. Make any other config tweaks you'd like. 5. Run `fetch_posts.py` to collect the posts from the followed user(s). 6. Run `gen.py` to generate the sentence and write it to the server. +7. (optional) set up cron or other periodic auto-run. run `reply.py` in the background. + +## Secure Fetch +Secure fetch (aka authorised fetches, authenticated fetches, secure mode...) is *not* supported by pleroma-ebooks, and will fail to download any posts from users on instances with secure fetch enabled. For more information, see [this wiki page](https://github.com/Lynnesbian/mstdn-ebooks/wiki/Secure-fetch). ## Compatibility | Software | Downloading statuses | Posting | Replying | diff --git a/generators/markov.py b/generators/markov.py index 4352c5e..a777f90 100644 --- a/generators/markov.py +++ b/generators/markov.py @@ -11,8 +11,8 @@ def make_sentence(cfg): db = sqlite3.connect(cfg["db_path"]) db.text_factory = str + p = regex.compile(r"\L", words=cfg["ignored_cws"],flags=regex.IGNORECASE) def cw_regexp(x): - p = regex.compile(r"\L", words=cfg["ignored_cws"],flags=regex.IGNORECASE) return 1 if p.search(x) else 0 db.create_function('cwregexp', 1, cw_regexp) c = db.cursor()