make_exports.sh
1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
set -e -x -o pipefail
if [ "$#" -ne 1 ]; then
echo "One argument needed: ‹DICT_VERSION›"
exit 1
fi
export DICT_VERSION=$1
export KUZNIA_DIR=`pwd`
export DICT_DIR=$KUZNIA_DIR/dicts
export SGJP_EXPORT_FILE=$DICT_DIR/sgjp-$DICT_VERSION.tab
export POLIMORF_EXPORT_FILE=$DICT_DIR/polimorf-$DICT_VERSION.tab
mkdir -p $DICT_DIR
function exportSGJP {
echo building $SGJP_EXPORT_FILE
set -x
WORK_DIR=`mktemp -d`
(cd $WORK_DIR
time $KUZNIA_DIR/manage.py export_lexemes SGJP | sort -n -k 1,1 | cut -f 2- | sort -s -k 2,2 > dict.tab
if cut -f 2 dict.tab | grep :|uniq | grep '[0-9]$' | sed 's/.$//' | sort | uniq -c | grep 1
then
echo 'Brakuje rozpodabniaczy (zob. wyżej)'
exit 1
fi
cat copyright.txt dict.tab > $SGJP_EXPORT_FILE
)
rm -r $WORK_DIR
}
export -f exportSGJP
function exportPolimorf {
echo building $POLIMORF_EXPORT_FILE
set -x
WORK_DIR=`mktemp -d`
(cd $WORK_DIR
time $KUZNIA_DIR/manage.py export_lexemes Morfeusz_PoliMorf | sort -n -k 1,1 | cut -f 2- | sort -s -k 2,2 > dict.tab
cat copyright.txt dict.tab > $POLIMORF_EXPORT_FILE
)
rm -r $WORK_DIR
}
export -f exportPolimorf
{
echo "exportSGJP"
echo "exportPolimorf"
} | xargs -n1 -P6 -d$'\n' bash -c