You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.0 KiB
Makefile

# TO DO #
# * If ocr (tesseract rule) has been performed do repeate it
# * document depencies
# * remove tmp files
dir_ocr:="ocr"
images=$(wildcard images/*.jpg)
output_ocr:=$(dir_ocr)/output.txt
tmpfile:= $(shell mktemp)
space:= $(empty) $(empty)
newline:= '\n'
listimgs:= $(subst $(space),$(newline),$(images)) # list of the images, with one filename on each line $(subst $(delimitator),$(replacement),$(list))
OS:= $(shell uname)
color_w:="\033[0;29m" # Colors
color_r:="\033[0;31m"
color_g:="\033[0;32m"
color_b:="\033[0;34m"
# add color to output ie @echo $(color_r) something
##### ADMINISTRATIVE RECIPES
dirs: # create the directories for the working structures
@mkdir -p images # scanned image dir
@mkdir -p output # outputs dir
@echo $(color_r)'Directories made'
rmtmp:
rm $(tmpfile)
testif:
ifeq ($(OS),Darwin)
@echo $(OS)
endif
##### POST-PROCESSING RECIPES
tesseract:
echo $(listimgs) > ocr/list.txt
tesseract ocr/list.txt $(basename $(output_ocr))
##### OUTPUT GENERATION RECIPES
myscript: tesseract
cat $(output_ocr) | python3 src/myscript.py > output/a-new-file.txt
wordtagger: tesseract
cat $(output_ocr) | python3 src/wordtagger.py > output/tagged-words.txt
# DEPENDENCY: nltk, nltk: 'averaged_perceptron_tagger'
# $ python 3
# >>> import nltk
# >>> nltk.download('averaged_perceptron_tagger')
talktochatbot: tesseract
cat $(output_ocr) | python3 src/textbotconversation.py
# depency: chatterbot
6 years ago
n+7: tesseract
cat $(output_ocr) | python3 src/n_7.py > output/n7.txt
6 years ago
visualization: $(images) $(tmpfile) #requires mplayer
@echo $(tmpfile)
for i in $(images); do \
cat $$i >> $(tmpfile); \
done;
ifeq ($(OS),Darwin)
cat $(tmpfile) | mplayer -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=56:h=64:i420:fps=25 -;
else
cat $(tmpfile) | mplayer -vo x11 -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=50:h=50:i420:fps=25 -;
endif
tts: # Text-to-speech
cat $(output_ocr) | espeak
# ** Makefile Syntax notes **
# @ preceding command tells make not to print the command being executed
#