Add training-data target to convert RST posts to plain text for ML training

Creates a new Makefile target that converts all RST blog posts to plain text format using pandoc, enabling use of blog content as training data for machine learning applications.
This commit is contained in:
russell@unturf.com 2026-03-08 16:53:41 -04:00
parent 2bae032864
commit 4bd8e24d62

View file

@ -1,4 +1,4 @@
.PHONY: html help clean regenerate serve devserver publish pygments jsonresume jsonresume-themes jsonresume-pdf rst2md llms jsonfeed jsonblog plaintext formats .PHONY: html help clean regenerate serve devserver publish pygments jsonresume jsonresume-themes jsonresume-pdf rst2md llms jsonfeed jsonblog plaintext formats training-data
BASEDIR=$(CURDIR) BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content INPUTDIR=$(BASEDIR)/content
@ -193,4 +193,17 @@ plaintext:
formats: rst2md plaintext jsonfeed jsonblog llms formats: rst2md plaintext jsonfeed jsonblog llms
@echo "All agent-friendly formats generated!" @echo "All agent-friendly formats generated!"
TRAINING_DATA_OUT ?= $(BASEDIR)/russell.ballestrini.net.txt
training-data: ## Convert all RST posts to plain text for ML training
@echo "converting $(words $(wildcard $(INPUTDIR)/*.rst)) RST posts to plain text via pandoc..."
@> $(TRAINING_DATA_OUT)
@count=0; \
for rst in $(INPUTDIR)/*.rst; do \
pandoc -f rst -t plain --wrap=none "$$rst" >> $(TRAINING_DATA_OUT) 2>/dev/null; \
echo "" >> $(TRAINING_DATA_OUT); \
count=$$((count + 1)); \
done; \
echo "russell.ballestrini.net: $$count posts, $$(wc -l < $(TRAINING_DATA_OUT)) lines"
SITEURL ?= https://russell.ballestrini.net SITEURL ?= https://russell.ballestrini.net