#hagen
FSA = /users1/vannoord/bin/fsa
# tcw2
#FSA = /home/vannoord/Linux/bin/fsa
TESTSIZE =  6125

errors : results
	cut -f 2 testdata  | paste results - | \
	awk '($$1 != $$2) {print $$0}' > errors
	wc -l errors | \
	awk '{print $$1 " mistakes, " ($$1/$(TESTSIZE) * 100) "%"}'

# fast but requires compilation to c (& thus deterministic automaton)
# results: morph.fsa
#	$(FSA) -cc < morph.fsa > morph.c
#	cc morph.c -o morph

# slow but more robust if compilation to c doesnt work....
results: morph.fsa
	cut -f 1 testdata  | $(FSA) -aa morph.fsa > results

morph.fsa : morph.pl 
	$(FSA) debug=1 regex_cache=on -aux morph.pl -r morph > morph.fsa

clean :
	rm -f morph.fsa morph morph.c results errors
