From 073f17ffa946262f602a2b388b6e619d0deb7ea3 Mon Sep 17 00:00:00 2001 From: jvdhorst Date: Tue, 27 Feb 2018 13:27:08 +0100 Subject: [PATCH] added desc in makefile --- Makefile | 12 ++++++------ README | 17 ++++++++--------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 5dfb1dd..7263297 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ 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)) +listimgs:= $(subst $(space),$(newline), $(images) ) # list of the images, with one filename on each line $(subst $(delimitator),$(replacement),$(list)) OS:= $(shell uname) # Colors: add color to output ie @echo $(color_r) output text color_w:="\033[0;29m" @@ -30,9 +30,9 @@ clean: ## removes output (target) files # ADMINISTRATIVE RECIPES dirs: ## create the dirs in working dir - @-mkdir -p images/ + @-mkdir -p images/ @-mkdir -p output/ - @echo $(color_r)'Directories made': images/ output/ + @echo $(color_r)'Directories made': images/ output/ @@ -53,18 +53,18 @@ ocr/output.txt: ## ocr with tesseract #OUTPUT GENERATION RECIPES -output/tagged-words.txt: ocr/output.txt ## DESCRIBE WHAT IT DOES. Dependecies: python3's nltk, nltk's averaged_perceptron_tagger +output/tagged-words.txt: ocr/output.txt ## Analyzes OCR'ed text using a Part of Speech (POS) tagger. Outputs a string of tags (e.g. nouns, verbs, adjectives, and adverbs). Dependencies: python3's nltk, nltk's averaged_perceptron_tagger cat $< | python3 src/wordtagger.py > $(@) # install nltk's 'averaged_perceptron_tagger': # $ python 3 # >>> import nltk # >>> nltk.download('averaged_perceptron_tagger') -output/chatbot.txt: ocr/output.txt ## DESCRIBE WHAT IT DOES. Dependecies: python3's chatterbot +output/chatbot.txt: ocr/output.txt ## DESCRIBE WHAT IT DOES. Dependencies: python3's chatterbot cat $< | python3 src/textbotconversation.py $(@) -output/n7.txt: ocr/output.txt ## DESCRIBE WHAT IT DOES. Dependecies: python3's chatterbot +output/n7.txt: ocr/output.txt ## DESCRIBE WHAT IT DOES. Dependencies: python3's chatterbot cat $< | python3 src/n_7.py > $(@) diff --git a/README b/README index a348d9c..14cb368 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ # Tools for scanned pages Get help on the different makefile targets by running: -`make` +`make` # Makefile Documentation @@ -20,7 +20,7 @@ https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html - preceeding a command tells make to ignore errors in a recipe line -## DEPENDECIES AND RULES +## DEPENDENCIES AND RULES a rule "asks" a *dependency* to be executed, only if the depency does not exist as a file i.e. I have the 2 following rules in my make file: @@ -31,8 +31,8 @@ list.txt: tts: list.txt cat $< | espeak ``` -when i run: `make tts` -tts rule will execute its dependency list.txt IF the list.xt does not exist in the top level of working directory. ELSE it will execute the list.txt +when i run: `make tts` +tts rule will execute its dependency list.txt IF the list.xt does not exist in the top level of working directory. ELSE it will execute the list.txt ## TARGET NAMES @@ -59,19 +59,19 @@ art: foo.txt ``` For the first time you run `make art` the foo.txt dependency rule will be executed In subsequent runs of `make art` foo.txt dependency rule will NOT be executed, because its target: foo.txt is already in the make working directory -To trigger the execution of foo.txt ruke, we need to remove its target from the working directoy +To trigger the execution of foo.txt rule, we need to remove its target from the working directoy That task if often delegate to a rule with target `clean` which removes the files/targets of make, such as ``` clean: removes output (target) files - rm ocr/output.txt + rm ocr/output.txt rm $(wildcard output/*) rm $(tmpfile) -``` +``` After running `make clean` the foo.txt rule is executed (as a dependancy) when running `make art` -Tagets can also include subfolders: +Targets can also include subfolders: ``` output/art.txt: foo.txt @@ -84,4 +84,3 @@ Read more on https://www.gnu.org/software/make/manual/html_node/Rule-Syntax.html # LINKS * About Makefile syntax: [5 Writing Recipes in Rules](https://www.gnu.org/software/make/manual/make.html#Recipes) -