Example Makefile for Clio 3. Performs some very basic text analysis on Tracts for the Times.
Last active
August 29, 2015 14:06
-
-
Save lmullen/d2d0162a0cda6301b748 to your computer and use it in GitHub Desktop.
Sample Makefile for Clio 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
analysis | |
html | |
text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat $1 | tr -d '[:punct:]' | tr [:space:] '\n' | sort | uniq -c | sort -bnr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
lynx -dump $1 | iconv -f WINDOWS-1252 -t UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ZIP := http://lincolnmullen.com/files/tracts-for-times.zip | |
TEXT := $(patsubst html/%.html, text/%.txt, $(wildcard html/*.html)) | |
ANALYSIS := $(patsubst text/%.txt, analysis/%.txt, $(wildcard text/*.txt)) | |
all : html $(TEXT) $(ANALYSIS) | |
tracts-for-times.zip : | |
@echo Download the zip file | |
curl -O $(ZIP) | |
unzip $^ -d $@ | |
html : tracts-for-times.zip | |
@echo Unzip the tracts into $@ | |
text/%.txt : html/%.html | |
./html2plaintext.sh $^ > $@ | |
analysis/%.txt : text/%.txt | |
mkdir -p analysis | |
./count-words.sh $^ > $@ | |
clean : | |
rm -f tracts-for-times.zip | |
rm -f html/* | |
rm -f text/* | |
rm -f analysis/* | |
.PHONY : clean clobber all | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment