pocketlearn / Makefile
SNAPKITTYWEST's picture
push from SNAPKITTYWEST/pocketlearn
ce0d85d verified
Raw
History Blame Contribute Delete
2.23 kB
.PHONY: all tokenize ontology background induction induced asp forth clean demo
all: background induction induced asp forth
@echo ""
@echo "=== PIPELINE COMPLETE ==="
@echo "Check: ontology_induced.xml — what ILP proposed"
@echo "Check: induction.log — rules learned"
@echo "Run: make demo"
# Step 1: corpus_tokens.xml already committed (from sample_corpus.txt)
tokenize:
@echo "[1/7] corpus_tokens.xml ready"
# Step 2: background Prolog facts from ontology.xml (ZERO PYTHON)
background:
@echo "[2/7] Background facts via XSLT"
xsltproc corpus_to_background.xslt ontology.xml > background.pl
# Step 3: ILP engine generated by XSLT from ontology.xml (meta-trick)
induction:
@echo "[3/7] ILP engine via XSLT (XSLT generates Prolog)"
xsltproc ontology_to_induction.xslt ontology.xml > ontology_induction_generated.pl
# Step 4: Run ILP — learn rules + propose new members
induced:
@echo "[4/7] ILP Induction"
swipl -s ontology_induction_generated.pl -g "halt." 2>&1 | tee induction.log
@echo "--- ILP output ---"
@cat induction.log
# Step 5: ASP validation (clingo rejects contradictions)
asp:
@echo "[5/7] ASP Validation"
xsltproc ontology_to_asp.xslt ontology_induced.xml > ontology_induced_facts.asp
cat ontology_induced_facts.asp ontology.asp > ontology_validated.asp
clingo ontology_validated.asp 0 && echo "ASP: SATISFIABLE" || echo "ASP: UNSAT — contradiction detected, rejected"
# Step 6: FORTH generation (XML -> FORTH dictionary)
forth:
@echo "[6/7] FORTH Generation"
xsltproc corpus_to_forth.xslt corpus_tokens.xml > generated_corpus_induced.fth
@echo "FORTH written to generated_corpus_induced.fth"
# Run the FORTH
demo:
@echo "[7/7] Running FORTH"
gforth generated_corpus_induced.fth
# Direct run of pre-generated FORTH (no xsltproc needed)
demo-prebuilt:
gforth generated_corpus_induced.fth
clean:
rm -f background.pl ontology_induction_generated.pl induction.log
rm -f ontology_induced_facts.asp ontology_validated.asp
rm -f generated_corpus_induced.fth
# Install dependencies
deps-mac:
brew install libxslt swi-prolog clingo gforth
deps-linux:
sudo apt install -y xsltproc swi-prolog gringo gforth