# ********************************************************************* # # This is a makefile that builds the XFST Rumanian morphological parser # # ********************************************************************* # # Usage notes: # There must be a sister catalogue bin/ to this directory, and the xerox tools # fst and lexc must be in the path (for use of xfst, see directly below). # The parsers compile with the following command: # make # Her bygger vi en analysator for rumensk # *************************************** # Tools used when compiling the transducers XFST = xfst #-utf8 #XFST = fst -utf8 LEXC = lexc #-utf8 ifeq (victorio.uit.no, $(shell hostname)) XFST = /opt/sami/xerox/c-fsm/ix86-linux2.6-gcc3.4/bin/fst -utf8 LEXC = /opt/sami/xerox/bin/lexc -utf8 TWOLC = /opt/sami/xerox/bin/twolc -utf8 endif # Kildefiler # ********** SRCS = rum-lex.txt \ noun-rum-lex.txt \ adj-rum-lex.txt \ verb-rum-lex.txt \ pron-rum-lex.txt \ num-rum-lex.txt \ pp-rum-lex.txt \ det-rum-lex.txt \ punct-rum-lex.txt \ # abbr-rum-lex.txt \ # acro-rum-lex.txt \ # prt-rum-lex.txt \ # Here we build the final generator , an inverted transducer of the analyzer. # It is dependent upon rum.save irum.fst: ../bin/irum.fst ../bin/irum.fst: ../bin/rum.fst #../bin/abbr.txt @echo @echo "*** Building the inverse irum.fst ***" @echo @printf "load ../bin/rum.save \n\ invert net \n\ save stack ../bin/irum.fst \n\ quit \n" > ../tmp/irum-fst-script $(XFST) < ../tmp/irum-fst-script @rm -f ../tmp/irum-fst-script # In order to make g-rum.fst we need a binary tag-rum.fst # This goal depends on tag-rum.regex tag-rum.fst: ../bin/tag-rum.fst ../bin/tag-rum.fst: tag-rum.regex @echo @echo "*** Building tag-rum.fst ***" ; @echo @printf "read regex < tag-rum.regex \n\ save stack ../bin/tag-rum.fst \n\ quit \n" > ../tmp/tag-rum-script $(XFST) < ../tmp/tag-rum-script @rm -f ../tmp/tag-rum-script # Here comes the part building the basic parser. # ********************************************** # This goal is to build the final analyser. It depends on all the files. rum.fst: ../bin/rum.fst ../bin/rum.fst: ../bin/rum.save ../bin/caseconv.fst @echo @echo "*** Building rum.fst ***" ; @echo @printf "read regex [[@\"../bin/rum.save\"] .o. \ [@\"../bin/caseconv.fst\"]] ; \n\ save stack ../bin/rum.fst \n\ quit \n" > ../tmp/rum-fst-script $(XFST) < ../tmp/rum-fst-script @rm -f ../tmp/rum-fst-script # Here we make the abbrevation file for our current preprocessor, # the perl-based preprocess (located in the script catalogue) empty:= comma:=, space:=$(empty) $(empty) ABBRSRCS=$(subst $(space),$(comma),$(LEX)) scripts=$(HOME)/gtsvn/gt/script abbr: ../bin/abbr.txt ../bin/abbr.txt: $(scripts)/abbr-extract $(scripts)/langTools/Util.pm $(LEX) @echo @echo "*** Extracting abbreviations from abbr-rum-lex.txt to abbr.txt ***" ; @echo @perl -I $(scripts) $(scripts)/abbr-extract \ --output=$@ \ --abbr_lex=abbr-rum-lex.txt \ --lex=$(ABBRSRCS) # The second goal is to build the caseconv.fst file # This goal depends on case.regex caseconv.fst: ../bin/caseconv.fst ../bin/caseconv.fst: case.regex @echo @echo "*** Building caseconv.fst ***" ; @echo @printf "read regex < case.regex \n\ save stack ../bin/caseconv.fst \n\ quit \n" > ../tmp/caseconv-script $(XFST) < ../tmp/caseconv-script @rm -f ../tmp/caseconv-script rum.save: ../bin/rum.save ../bin/rum.save: ../bin/xfst-rum.bin ../bin/rum-lex.save @echo @echo "*** Building the parser rum.save ***" @echo @printf "read regex [[@\"../bin/rum-lex.save\"] .o. \ [@\"../bin/xfst-rum.bin\"]] ; \n\ save stack ../bin/rum.save \n\ quit \n" > ../tmp/rum-save-script $(XFST) < ../tmp/rum-save-script @rm -f ../tmp/rum-save-script # The first goal is to build rum-lex.save # This goal depends on a bunch of lexicon files rum-lex.save: ../bin/rum-lex.save ../bin/rum-lex.save: $(SRCS) @echo @echo "*** Building rum-lex.save ***" ; @echo printf "compile-source $(SRCS) \n\ save-source ../bin/rum-lex.save \n\ quit \n" > ../tmp/rum-lex-save-script $(LEXC) < ../tmp/rum-lex-save-script @rm -f ../tmp/rum-lex-save-script # @printf "read lexc < $(SRCS) \n\ # save stack ../bin/rum-lex.save \n\ # quit \n" > ../tmp/rum-lex-save-script # $(XFST) < ../tmp/rum-lex-save-script # @rm -f ../tmp/rum-lex-save-script # Here we build xfst-rum.bin, the morphophonological component. # This goal depends on xfst-rum.txt xfst-rum.bin: ../bin/xfst-rum.bin ../bin/xfst-rum.bin: xfst-rum.txt @echo @echo "*** Building xfst-rum.bin ***" ; @echo @printf "source xfst-rum.txt \n\ save stack ../bin/xfst-rum.bin \n\ quit \n" > ../tmp/xfst-rum-script $(XFST) < ../tmp/xfst-rum-script @rm -f ../tmp/xfst-rum-script clean: @rm -f ../bin/*.bin ../bin/*.fst ../bin/*.save