-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.data_gener
98 lines (84 loc) · 5.5 KB
/
makefile.data_gener
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
SHELL=/bin/bash
DATE := $(shell date +%Y-%m-%d_%H-%M-%S)
TMT_VERSION := $(shell echo `git rev-parse --abbrev-ref HEAD`:`git rev-parse HEAD | cut -c 1-10`)
DATA_SET = train
DATA_ID = pcedt
DATA_DIR=data/analysed/$(DATA_ID)/$(DATA_SET)
DATA_VERSION := $(shell cat $(DATA_DIR)/last_id 2> /dev/null || echo 0000)
DATA_NEXT_VERSION := $(shell expr $(DATA_VERSION) + 1 | perl -ne 'printf "%.4d", $$_;' )
JOBS_NUM = 50
ifeq (${DATA_SET}, train)
JOBS_NUM = 100
endif
MEM=3G
LRC=1
ifeq (${LRC}, 1)
LRC_FLAGS = -p --qsub '-hard -l mem_free=$(MEM) -l act_mem_free=$(MEM) -l h_vmem=$(MEM)' --jobs ${JOBS_NUM}
endif
morpho_pcedt : data/${DATA_SET}.pcedt.analysed.morpho.list
data/${DATA_SET}.${DATA_ID}.analysed.morpho.list : data/${DATA_SET}.${DATA_ID}.list
treex ${LRC_FLAGS} \
Read::Treex from=@data/${DATA_SET}.pcedt.list \
Util::Eval language=en zone='$$zone->set_selector("ref");' \
Util::Eval language=cs zone='$$zone->set_selector("ref");' \
scenarios/prepare_for_analysis.scen \
scenarios/s1_morpho.scen \
Write::Treex path=data/analysed/${DATA_ID}/${DATA_SET} stem_suffix=.morpho \
Write::LemmatizedBitexts selector=src language=cs to_language=en to_selector=src \
| gzip -c > data/analysed/${DATA_ID}/${DATA_SET}/for_giza.gz
ls data/analysed/${DATA_ID}/${DATA_SET}/*.morpho.treex.gz > data/${DATA_SET}.${DATA_ID}.analysed.morpho.list
# qsubmit --disk=400g --mem=40g --jobname=giza.gz \
| paste <(zcat $< | cut -f1 | sed 's/hali.gz/morpho.treex.gz/') - \
--mgizadir=$(shell pwd)/src/mgizapp/ $< \
giza_pcedt : data/analysed/${DATA_ID}/${DATA_SET}/giza.gz
data/analysed/${DATA_ID}/${DATA_SET}/giza.gz : data/analysed/${DATA_ID}/${DATA_SET}/for_giza.gz
bin/gizawrapper.pl \
--tempdir=/mnt/h/tmp \
--bindir=$(shell pwd)/bin $< \
--lcol=1 --rcol=2 \
--keep \
--dirsym=gdfa,int,left,right,revgdfa \
| paste <(zcat $< | cut -f1 | sed 's/^.*\(wsj.*\)$$/data\/analysed\/${DATA_ID}\/${DATA_SET}\/\1/' | sed 's/treex/morpho\.treex/') - \
| gzip > $@
analyse_pcedt : data/${DATA_SET}.pcedt.analysed.parsed.list
data/${DATA_SET}.${DATA_ID}.analysed.parsed.list : data/${DATA_SET}.${DATA_ID}.analysed.morpho.list data/analysed/${DATA_ID}/${DATA_SET}/giza.gz
treex ${LRC_FLAGS} \
Read::Treex from=@data/${DATA_SET}.${DATA_ID}.analysed.morpho.list \
Align::A::InsertAlignmentFromFile from=data/analysed/${DATA_ID}/${DATA_SET}/giza.gz \
inputcols=gdfa_int_left_right_revgdfa_therescore_backscore \
selector=src language=cs to_selector=src to_language=en \
scenarios/s3_parsing.scen \
Write::Treex path=data/analysed/${DATA_ID}/${DATA_SET} stem_suffix=.parsed
ls data/analysed/${DATA_ID}/${DATA_SET}/*.parsed.treex.gz > data/${DATA_SET}.${DATA_ID}.analysed.parsed.list
gold_system_pcedt : data/${DATA_SET}.pcedt.analysed.list
data/${DATA_SET}.${DATA_ID}.analysed.list : data/${DATA_SET}.${DATA_ID}.analysed.parsed.list
treex ${LRC_FLAGS} \
Read::Treex from=@data/${DATA_SET}.${DATA_ID}.analysed.parsed.list \
scenarios/align_src_ref.scen \
Write::Treex clobber=1 path=data/analysed/${DATA_ID}/${DATA_SET} stem_suffix=.final
ls data/analysed/${DATA_ID}/${DATA_SET}/*.final.treex.gz > data/${DATA_SET}.${DATA_ID}.analysed.list
fix_alignment : $(DATA_DIR)/$(DATA_VERSION)/list
mkdir -p $(DATA_DIR)/$(DATA_NEXT_VERSION)
-treex $(LRC_FLAGS) -Lcs -Ssrc \
Read::Treex from=@$< \
Util::Eval anode='use Treex::Tool::Align::Utils; Treex::Tool::Align::Utils::remove_aligned_nodes_by_filter($$anode, {language => "en", selector => "src"});' \
Util::Eval tnode='use Treex::Tool::Align::Utils; Treex::Tool::Align::Utils::remove_aligned_nodes_by_filter($$tnode, {language => "en", selector => "src"});' \
Align::A::AlignMGiza from_language=cs from_selector=src to_language=en to_selector=src dir_or_sym=intersection,grow-diag-final-and model_from_share=cs-en cpu_cores=1 \
My::AlignmentEconomic \
Align::T::CopyAlignmentFromAlayer selector=src language=cs to_selector=src to_language=en \
Align::T::AlignCzechPersprons selector=src language=cs to_selector=src to_language=en \
Write::Treex path=$(DATA_DIR)/$(DATA_NEXT_VERSION)
find $(DATA_DIR)/$(DATA_NEXT_VERSION) -name '*.final.treex.gz' | sort | sed 's/^.*\///' > $(DATA_DIR)/$(DATA_NEXT_VERSION)/list
echo -e "$(DATA_NEXT_VERSION)\t$(DATE)\t$(TMT_VERSION)\treplacing old alignment with cs-en (inter,gdfa) alignment by MGiza trained on CzEng 1.0" >> $(DATA_DIR)/history
echo $(DATA_NEXT_VERSION) > $(DATA_DIR)/last_id
# this filters alignment links within the src zone to contain just int, gdfa or rule-based; removes left, right, revgdfa
filter_alignment : $(DATA_DIR)/$(DATA_VERSION)/list
mkdir -p $(DATA_DIR)/$(DATA_NEXT_VERSION)
-treex $(LRC_FLAGS) -Lcs -Ssrc \
Read::Treex from=@$< \
Util::Eval anode='use Treex::Tool::Align::Utils; Treex::Tool::Align::Utils::remove_aligned_nodes_by_filter($$anode, {language => "en", selector => "src", rel_types => ["!int", "!([^v]|^)gdfa", "!rule-based", ".*"]});' \
Util::Eval tnode='use Treex::Tool::Align::Utils; Treex::Tool::Align::Utils::remove_aligned_nodes_by_filter($$tnode, {language => "en", selector => "src", rel_types => ["!int", "!([^v]|^)gdfa", "!rule-based", ".*"]});' \
Write::Treex path=$(DATA_DIR)/$(DATA_NEXT_VERSION)
find $(DATA_DIR)/$(DATA_NEXT_VERSION) -name '*.final.treex.gz' | sort | sed 's/^.*\///' > $(DATA_DIR)/$(DATA_NEXT_VERSION)/list
echo -e "$(DATA_NEXT_VERSION)\t$(DATE)\t$(TMT_VERSION)\tremoving left, right and revgdfa links from the original alignments calculated on train and dev portions of PCEDT" >> $(DATA_DIR)/history
echo $(DATA_NEXT_VERSION) > $(DATA_DIR)/last_id