#!/usr/bin/perl -s our ($n,$d,$t,$tok); #-t=html for mkterminum; -tok nat-create tokenizer use common::sense; use utf8::all; my $file = shift; my $state = "0"; my $log=q{echo `date +'%F %T'` "#T:" $< "==> " $@ >> perfide-log }; my $dot=q{echo $< "->" $@ ";" >> perfide.dot }; my $F; my $makevars = ""; if($t){$makevars .= "TYPE='-t=$t'"} if($tok){$makevars .= "TOK='-tokenize'"} if($n){$F = *STDOUT; } else {open( $F, "|-", "tee debug | make $makevars -f - $file "); } while(){ my $tool=''; if(/#tools/){$/=''; $state="tools"; next}; if(s!^(\w+(?:-\w+)*)\s*:\s*(\w+)\s*→\s*(\w+)!.$2.$3:! ){ $tool=$1; s/#T\b/$tool/g; } last if /__END__/; if($state eq "tools"){ s/(\s*)$/\n\t-$log\n\t-$dot$1/} print $F $_; }; close $F; __DATA__ SHELL = /bin/bash .SUFFIXES: .tmx .tmxcl .atmx .ptd .ucts .bws .pairs .tmxd .boot .aptd .pltmx .po .blocks .PRECIOUS: %.tmx %.tmxcl %.atmx %.ptd %.ucts %.bws %.pairs %.tmxd %.boot %.aptd %.pltmx %.po %.blocks a := $(wildcard _*[a-zA-Z0-9-].tmx) b := $(patsubst %.tmx,%.tmxcl,$(wildcard _*.tmx)) TYPE= TOK= #tools tmxcleaner: tmx → tmxcl tmxclean -eq -len -junk -sw $< tmxuniq _cleaned_$< - rm _cleaned_$< __tmxuniq_* mv _cleaned_$<._ $@ atmx2pltmx : atmx → pltmx atmx2pltmx $< mkaptd: pltmx → aptd nat-create -id=$@_ $(TOK) -tmx -csize=700000 $< touch $@ tmxpos-tagger : tmxcl → atmx tmx-POStagger -ner $< mv pos_$< $@ tmx2ptd: tmxcl → ptd nat-create -id=$@_ $(TOK) -tmx -csize=700000 $< touch $@ ptd2ucts : ptd → ucts nat-ptd ucts $<_/source-target.dmp $<_/target-source.dmp | \ awk -F "=" '$$1 != $$2 {print}' | sort -fV | \ grep -v '[0-9;.!?"^]' > $@ ptd2bws: ptd → bws nat-ptd bws $<_/source-target.dmp $<_/target-source.dmp | \ awk -F "=" '$$1 != $$2 {print}' | sort -u | sort -fV | \ grep -Ev 'Langs: |[0-9;.!?"^]' > $@ mkterminum: pairs → tmxd mkterminum $(TYPE) -isutf8 -q0 -skipch $< touch $@ tmxprepare: tmxd → tmx # iconv -f utf8 -t latin1 $ $@ # utf8restore -mkmiracles $ $@ # cp $ $@ # echo `date +'%F %T'` "#T:" $< "==> " $@ >> perfide-log po2tmx: po → tmx perl -nE 'say /\b(\w\w|\w\w_\w\w)\b/' <<< $< po2tmx -s=$$a $< utf8restore -mkmiracles _1.aux > $@ dir2pairs: boot → pairs mkterminum -isutf8 -q0 -skipch $