From 1fdc6b0f61c0fc8cbddc3d1ad5e834e4145ce5be Mon Sep 17 00:00:00 2001 From: Natasha Berting Date: Fri, 23 Mar 2018 14:56:29 +0100 Subject: [PATCH] added my scripts to makefile --- Makefile | 9 ++++++++- src/replace_leastcommon.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c0c31d5..32a4b6e 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ images=$(sort $(wildcard images/*.jpg)) # @andre make wildcard so that it takes any image file but doesn't take the listimg.txt file +images-tiff=$(sort $(wildcard images-tiff/*.jpg)) output_ocr:=$(dir_ocr)/output.txt tmpfile:= $(shell mktemp) space:= $(empty) $(empty) @@ -34,9 +35,10 @@ dirs: ## create the dirs in working dir @-mkdir -p images/ @-mkdir -p images-tiff/ @-mkdir -p output/ + @-mkdir -p output/erase-replace/ @-mkdir -p ocr/ @-mkdir -p hocr/ - @echo $(color_r)'Directories made': images/ output/ + @echo $(color_r)'Directories made': ocr/ hocr/ images/ images-tiff/ output/ testif: @@ -95,6 +97,11 @@ overunder: ocr/output.txt ## Alice: An interpreted language that translate simpl @python3 src/overunder.py .PHONY: overunder +erase: ## Natasha: Analyzes pages in order, erases least common words from view. Dependencies: PIL, html5lib, FPDF + python3 src/erase_leastcommon.py + +replace: ## Natasha: Analyzes pages in order, replace least common words with most common words. Dependencies: PIL, html5lib, FPDF + python3 src/replace_leastcommon.py visualization: $(images) $(tmpfile) ##Creates data visualization from images/*.jpg. Dependencies: mplayer @echo $(tmpfile) diff --git a/src/replace_leastcommon.py b/src/replace_leastcommon.py index b596d2a..56f5dca 100644 --- a/src/replace_leastcommon.py +++ b/src/replace_leastcommon.py @@ -99,7 +99,7 @@ for i in scanimg: #extract coordinates if word.lower() in mostcommon_list and len(word) > 1 and len(word) <= 5: - wim.save ("output/erase-replace/crops4/wimreplace{}.png".format(num)) + wim.save ("output/erase-replace/crops4/wimreplace{}.png".format(num)) elif word in mostcommon_list and len(word) <= 7 : wim.save ("output/erase-replace/crops7/wimreplace{}.png".format(num)) elif word in mostcommon_list and len(word) > 7 :