-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add the preprocess argument "l2" for the double layout book
- check if file or directory exist before the deleting or moving actions - stability improvements - The script ./namsel-ocr doesn't delete the directory ./data/out after the ocr completion
- Loading branch information
1 parent
fcfa4f0
commit 7011f08
Showing
7 changed files
with
150 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,49 @@ | ||
#! /bin/bash | ||
#! /bin/bash -x | ||
|
||
if [ -z "$1" ] | ||
if [ $# -eq 2 ] | ||
then | ||
if [[ $1 =~ ^-?[0-9]+$ ]] && [ $2 == "l2" ] | ||
then | ||
python namsel.py preprocess --threshold=$1 --layout double ./data | ||
elif [ $1 == "l2" ] && [[ $2 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess --threshold=$2 --layout double ./data | ||
elif [ $1 == "l2" ] && [ $2 == "l2" ] | ||
then | ||
python namsel.py preprocess --layout double ./data | ||
elif [[ $1 =~ ^-?[0-9]+$ ]] && [[ $2 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess ./data | ||
else | ||
python namsel.py preprocess --threshold=$1 ./data | ||
elif [ $1 == "l2" ] | ||
then | ||
python namsel.py preprocess --layout double ./data | ||
elif [[ $1 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess --threshold=$1 ./data | ||
elif [ $2 == "l2" ] | ||
then | ||
python namsel.py preprocess --layout double ./data | ||
elif [[ $2 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess --threshold=$2 ./data | ||
else | ||
python namsel.py preprocess ./data | ||
fi | ||
elif [ $1 == "l2" ] | ||
then | ||
python namsel.py preprocess --layout double ./data | ||
elif [[ $1 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess --threshold=$1 ./data | ||
else | ||
python namsel.py preprocess ./data | ||
fi | ||
python namsel.py recognize-volume --format text --page_type book --line_break_method line_cut --clear_hr True ./data/out | ||
mv ocr_output.txt ./data | ||
rm -R ./data/out | ||
if [ -f ./ocr_output.txt ] | ||
then | ||
mv ocr_output.txt ./data | ||
fi | ||
if [ -d ./data/out ] | ||
then | ||
rm -R ./data/out | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,28 @@ | ||
#! /bin/bash | ||
#! /bin/bash -x | ||
|
||
if [ -z "$1" ] | ||
if [ $# -eq 2 ] | ||
then | ||
if [[ $1 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess ./data | ||
else | ||
python namsel.py preprocess --threshold=$1 ./data | ||
elif [[ $2 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess --threshold=$2 ./data | ||
else | ||
python namsel.py preprocess ./data | ||
fi | ||
elif [[ $1 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess --threshold=$1 ./data | ||
else | ||
python namsel.py preprocess ./data | ||
fi | ||
python namsel.py recognize-volume --format text --page_type pecha --line_break_method line_cluster ./data/out | ||
mv ocr_output.txt ./data | ||
rm -R ./data/out | ||
if [ -f ./ocr_output.txt ] | ||
then | ||
mv ocr_output.txt ./data | ||
fi | ||
if [ -d ./data/out ] | ||
then | ||
rm -R ./data/out | ||
fi |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
#! /bin/bash | ||
#! /bin/bash -x | ||
|
||
if [ -d ./data/out ]; then | ||
dir="./data/out" | ||
if [ -d ./data/out ] | ||
then | ||
dir="./data/out" | ||
else | ||
dir="./data" | ||
dir="./data" | ||
fi | ||
python namsel.py recognize-volume --format text --page_type book --line_break_method line_cut --clear_hr True $dir | ||
mv ocr_output.txt ./data | ||
if [ -d ./data/out ]; then | ||
rm -R ./data/out | ||
if [ -f ./ocr_output.txt ] | ||
then | ||
mv ocr_output.txt ./data | ||
fi | ||
if [ -d ./data/out ] | ||
then | ||
rm -R ./data/out | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
#! /bin/bash | ||
#! /bin/bash -x | ||
|
||
if [ -d ./data/out ]; then | ||
dir="./data/out" | ||
if [ $1 == "preprocess" ] | ||
then | ||
dir="./data" | ||
elif [ -d ./data/out ] | ||
then | ||
dir="./data/out" | ||
else | ||
dir="./data" | ||
dir="./data" | ||
fi | ||
python namsel.py $* $dir | ||
mv ocr_output.txt ./data | ||
if [ -d ./data/out ]; then | ||
rm -R ./data/out | ||
if [ $1 != "preprocess" ] && [ -f ./ocr_output.txt ] | ||
then | ||
mv ocr_output.txt ./data | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
#! /bin/bash | ||
#! /bin/bash -x | ||
|
||
if [ -d ./data/out ]; then | ||
dir="./data/out" | ||
if [ -d ./data/out ] | ||
then | ||
dir="./data/out" | ||
else | ||
dir="./data" | ||
dir="./data" | ||
fi | ||
python namsel.py recognize-volume --format text --page_type pecha --line_break_method line_cluster $dir | ||
mv ocr_output.txt ./data | ||
if [ -d ./data/out ]; then | ||
rm -R ./data/out | ||
if [ -f ./ocr_output.txt ] | ||
then | ||
mv ocr_output.txt ./data | ||
fi | ||
if [ -d ./data/out ] | ||
then | ||
rm -R ./data/out | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,40 @@ | ||
#! /bin/bash | ||
#! /bin/bash -x | ||
|
||
if [ -z "$1" ] | ||
if [ $# -eq 2 ] | ||
then | ||
if [[ $1 =~ ^-?[0-9]+$ ]] && [ $2 == "l2" ] | ||
then | ||
python namsel.py preprocess --threshold=$1 --layout double ./data | ||
elif [ $1 == "l2" ] && [[ $2 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess --threshold=$2 --layout double ./data | ||
elif [ $1 == "l2" ] && [ $2 == "l2" ] | ||
then | ||
python namsel.py preprocess --layout double ./data | ||
elif [[ $1 =~ ^-?[0-9]+$ ]] && [[ $2 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess --threshold=$1 ./data | ||
elif [ $1 == "l2" ] | ||
then | ||
python namsel.py preprocess --layout double ./data | ||
elif [[ $1 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess ./data | ||
else | ||
python namsel.py preprocess --threshold=$1 ./data | ||
elif [ $2 == "l2" ] | ||
then | ||
python namsel.py preprocess --layout double ./data | ||
elif [[ $2 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess --threshold=$2 ./data | ||
else | ||
python namsel.py preprocess ./data | ||
fi | ||
elif [ $1 == "l2" ] | ||
then | ||
python namsel.py preprocess --layout double ./data | ||
elif [[ $1 =~ ^-?[0-9]+$ ]] | ||
then | ||
python namsel.py preprocess --threshold=$1 ./data | ||
else | ||
python namsel.py preprocess ./data | ||
fi |