debbuged errors from makefile; Tieded a bit, but there still is a a todo list to be done

master
Castro0o 7 years ago
parent ecbd7fb649
commit ed9558c216

@ -1,19 +1,31 @@
images=$(wildcard images/*.jpg) # TO DO #
# creates: images/001.jpg images/002.jpg images/000.jpg # * 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) tmpfile:= $(shell mktemp)
color_w:="\033[0;29m" # add color to output
color_r:="\033[0;31m" # echo $(color_r) something
color_g:="\033[0;32m"
color_b:="\033[0;34m"
space:= $(empty) $(empty) space:= $(empty) $(empty)
newline:= '\n' newline:= '\n'
listimgs:= $(subst $(space),$(newline),$(images))0 listimgs:= $(subst $(space),$(newline),$(images)) # list of the images, with one filename on each line $(subst $(delimitator),$(replacement),$(list))
OS:= $(shell uname) OS:= $(shell uname)
ocroutput:= ocr/output.txt
txtfiles:= $(wildcard ocr/*.txt) color_w:="\033[0;29m" # Colors
# subst is a way to do string replacements, it works like this: $(subst $(delimitator),$(replacement),$(list)) color_r:="\033[0;31m"
# it's used here to make a list of the images, with one filename on each line 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: rmtmp:
rm $(tmpfile) rm $(tmpfile)
@ -23,47 +35,51 @@ ifeq ($(OS),Darwin)
@echo $(OS) @echo $(OS)
endif endif
dirs: # create the directories for the working structures
mkdir images # scanned image dir ##### POST-PROCESSING RECIPES
mkdir output # outputs dir
@echo $(color_r)'Directories made'
tesseract: tesseract:
echo $(listtxt) > output/list.txt echo $(listimgs) > ocr/list.txt
tesseract ocr/list.txt $(basename $(ocroutput)) tesseract ocr/list.txt $(basename $(output_ocr))
##### OUTPUT GENERATION RECIPES
myscript: tesseract myscript: tesseract
cat $(outputocr) | python3 src/myscript.py > output/a-new-file.txt cat $(output_ocr) | python3 src/myscript.py > output/a-new-file.txt
wordtagger: tesseract wordtagger: tesseract
cat $(output_ocr) | python3 src/wordtagger.py > output/tagged-words.txt
cat $(outputocr) | 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 talktochatbot: tesseract
cat $(outputocr) | python3 src/textbotconversation.py cat $(output_ocr) | python3 src/textbotconversation.py
# depency: chatterbot
n+7: tesseract n+7: tesseract
cat $(outputocr) | python3 src/n_7.py > output/blah.txt cat $(output_ocr) | python3 src/n_7.py > output/n7.txt
visualization: $(images) $(tmpfile) #requires mplayer visualization: $(images) $(tmpfile) #requires mplayer
@echo $(tmpfile) @echo $(tmpfile)
for i in $(images); do \ for i in $(images); do \
cat $$i >> $(tmpfile); \ cat $$i >> $(tmpfile); \
done; done;
ifeq ($(OS),Darwin) ifeq ($(OS),Darwin)
cat $(tmpfile) | mplayer -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=56:h=64:i420:fps=25 -; cat $(tmpfile) | mplayer -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=56:h=64:i420:fps=25 -;
else else
cat $(tmpfile) | mplayer -vo x11 -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=50:h=50:i420:fps=25 -; cat $(tmpfile) | mplayer -vo x11 -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=50:h=50:i420:fps=25 -;
endif endif
# ifeq ($(shell uname), Linux)
# cat $(tmpfile) | mplayer -vo x11 -sws 4 -zoom -vf dsize=720:720 -demuxer rawvideo -rawvideo w=50:h=50:i420:fps=25 -;\ tts: # Text-to-speech
cat $(output_ocr) | espeak
# ** Makefile Syntax notes ** # ** Makefile Syntax notes **
# @ preceding command tells make not to print the command being executed # @ preceding command tells make not to print the command being executed
# #
tts:
cat $(ocroutput) | espeak

Loading…
Cancel
Save