Skip to content

Instantly share code, notes, and snippets.

@kowey
Created January 11, 2011 15:16
Show Gist options
  • Select an option

  • Save kowey/774539 to your computer and use it in GitHub Desktop.

Select an option

Save kowey/774539 to your computer and use it in GitHub Desktop.
Experiments with redo
-include ../../config
define clean-train
cd $(<D) ; $(MOSES_SCRIPTS)/training/clean-corpus-n.perl $(notdir $(basename $<)) en mrl moses-corpus 1 100
mv $(basename $@).en $(basename $@).clean-en
mv $(basename $@).mrl $(basename $@).clean-mrl
endef
ifdef DISABLE_MOSES_TUNING
%/moses-corpus.clean-en : %/trainNdev-full-corpus.en %/trainNdev-full-corpus.mrl
$(call clean-train)
else
%/moses-corpus.clean-en : %/train-full-corpus.en %/train-full-corpus.mrl
$(call clean-train)
endif
%/moses-corpus.clean-mrl : | %/moses-corpus.clean-en
# moses-corpus.mrl and moses-corpus.en are generated together
# common/moses-corpus.clean-en.do
. ../../../../lib
if [ $DISABLE_MOSES_TUNING -eq 0 ]; then
# enable
CORPUS=train-full-corpus
else
CORPUS=trainNdev-full-corpus
fi
redo-ifchange $CORPUS.en $CORPUS.mrl
BNAME=`basename $1 .clean-en`
$MOSES_SCRIPTS/training/clean-corpus-n.perl $CORPUS en mrl moses-corpus 1 100
mv $BNAME.en $3
# common/moses-corpus.clean-mrl.do
BNAME=`basename $1 .clean-mrl`
redo-ifchange $BNAME.clean-en
mv $BNAME.mrl $3

PRO

I think the AFTER is cleaner (but is that a result of hindsight or actually changing tools?).

  • Only one syntax to deal with at a time (your shell language, not that PLUS make)
  • Can interleave dependency information in script in more general ways than using things like $@

CON

  • It seems tricky to express idea that foo/x.y and bar/x.y are built the same way. This is one thing that the makefile does better than my redo script (the % stands for foo or bar). With redo, I'm using a common/x.y.do and having a script copy them from common to foo/ and bar/. :-/
  • Possibly tricky to have common information (note the . ../../../../lib)

Surprises

  • default.x.do and foo.x.do provide different conventions for how $1 and $2 behave. There's justification in the manual, but do people really read manuals? Oh well, we'll have to see how djbredo behaves
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment