1 | ## AMC parameters
|
2 |
|
3 | # density of the scans (default 300)
|
4 | density=300
|
5 |
|
6 | # tolerance of the detection
|
7 | # it can be a single real number or inf,sup for different ranges
|
8 | tolerance=0.3,0.2
|
9 |
|
10 | # proportion of each box to be considered thicked
|
11 | proportion=0.15
|
12 |
|
13 | # black and white convertion threshold (0 white, 1 black)
|
14 | bwTrheshold=0.6
|
15 |
|
16 | # whether copies where made (leave unset or false, otherwise it will be considered true)
|
17 | copies=true
|
18 |
|
19 | # whether to debug or not (leave unset or false, otherwise it will be considered true)
|
20 | debug=true
|
21 |
|
22 | # export format
|
23 | exportFormat=ods
|
24 |
|
25 | ## My parameters
|
26 |
|
27 | projectDir=/home/adin/MC-Projects/encuesta
|
28 |
|
29 | scanFile=/home/adin/Downloads/2016-1/20160603204803394.pdf
|
30 |
|
31 | listFile=list-files.txt
|
32 |
|
33 | exportFile=$(basename $scanFile)
|
34 | exportFile="${exportFile%.*}".$exportFormat
|
35 |
|
36 | scansDir=scans
|
37 | processDir=process
|
38 |
|
39 |
|
40 | ## Process
|
41 | # create dirs
|
42 | mkdir $scansDir
|
43 | mkdir $processDir
|
44 |
|
45 | # create list of files to process
|
46 | echo $scanscanFile > $listFile
|
47 |
|
48 | # extract pages
|
49 | auto-multiple-choice getimages \
|
50 | --copy-to $scansDir \
|
51 | --vector-density $density \
|
52 | --list $listFile
|
53 |
|
54 | # process images
|
55 | ls -d -1 $scansDir/** > $listFile
|
56 |
|
57 | # configs mutliple in case of copies
|
58 | # if $copies then
|
59 | # multiple=--multiple
|
60 | # fi
|
61 | if [ -z ${copies+x} -o "$copies" = "false" ]; then
|
62 | # $copies is unset
|
63 | multiple=''
|
64 | echo "Processing single values"
|
65 | else
|
66 | # $copies is set
|
67 | multiple=--multiple
|
68 | echo "Processing photocopies"
|
69 | fi
|
70 |
|
71 | if [ -z ${debug+x} -o "$debug" = "false" ]; then
|
72 | # $debug is unset
|
73 | debugPar=
|
74 | else
|
75 | # $debug is set
|
76 | debugFile=analyse.log
|
77 | debugPar="--debug $debugFile"
|
78 | touch $debugFile
|
79 | fi
|
80 |
|
81 |
|
82 | auto-multiple-choice analyse \
|
83 | --data $projectDir/data \
|
84 | --cr $processDir \
|
85 | $multiple \
|
86 | --tol-marque $tolerance \
|
87 | --prop $proportion \
|
88 | --bw-threshold $bwTrheshold \
|
89 | --try-three \
|
90 | --pre-allocate 1 \
|
91 | --liste-fichiers $listFile \
|
92 | $debugPar
|
93 |
|
94 |
|
95 | # grade the scans
|
96 | if [ -z ${debug+x} -o "$debug" = "false" ]; then
|
97 | # $debug is unset
|
98 | debugPar=
|
99 | else
|
100 | # $debug is set
|
101 | debugFile=note.log
|
102 | debugPar="--debug $debugFile"
|
103 | touch $debugFile
|
104 | fi
|
105 |
|
106 | # extract the grades first
|
107 | auto-multiple-choice prepare \
|
108 | --mode b \
|
109 | --data $projectDir/data \
|
110 | --with pdflatex \
|
111 | $projectDir/encuesta.tex
|
112 |
|
113 | # then do the grading
|
114 | auto-multiple-choice note \
|
115 | --data $projectDir/data \
|
116 | --seuil $proportion \
|
117 | --notemin 0 \
|
118 | --notemax 10 \
|
119 | --grain 0.5 --arrondi n \
|
120 | --plafond \
|
121 | $debugPar
|
122 |
|
123 | # export
|
124 | if [ -z ${debug+x} -o "$debug" = "false" ]; then
|
125 | # $debug is unset
|
126 | debugPar=
|
127 | else
|
128 | # $debug is set
|
129 | debugFile=export.log
|
130 | debugPar="--debug $debugFile"
|
131 | touch $debugFile
|
132 | fi
|
133 |
|
134 |
|
135 | auto-multiple-choice export \
|
136 | --data $projectDir/data \
|
137 | --module $exportFormat \
|
138 | --o $exportFile \
|
139 | --useall 0 \
|
140 | $debugPar |