# Hunspell "environment variables" M4FLAGS = -DHUNSPELL # Hunspell source files HSPSRCjava = $(TARGET)/hunspell/abbr-$(TARGET).txt \ $(TARGET)/hunspell/acro-$(TARGET).txt \ $(TARGET)/hunspell/adv-$(TARGET).txt \ $(TARGET)/hunspell/conjunction-$(TARGET).txt \ $(TARGET)/hunspell/interjection-$(TARGET).txt \ $(TARGET)/hunspell/numeral-$(TARGET).txt \ $(TARGET)/hunspell/particle-$(TARGET).txt \ $(TARGET)/hunspell/pp-$(TARGET).txt \ $(TARGET)/hunspell/subjunction-$(TARGET).txt \ $(TARGET)/hunspell/pronoun-$(TARGET).txt \ $(TARGET)/hunspell/num-$(TARGET).txt HSPSRCfst = $(TARGET)/hunspell/adj-$(TARGET).txt \ $(TARGET)/hunspell/noun-$(TARGET).txt \ $(TARGET)/hunspell/propernoun-$(TARGET).txt \ $(TARGET)/hunspell/verb-$(TARGET).txt HSPSRCprefix = $(TARGET)/hunspell/middle-noun-$(TARGET).txt HSPJavaMiddle = $(TARGET)/src/$(TARGET)-lex.txt HSPSRCnum = $(TARGET)/hunspell/generated_nums.txt sinclude $(TARGET)/hunspell.mk # This target must be built with M4FLAGS=-DHUNSPELL hunspellspeller: tmp/all-hsp-$(TARGET).sorted @echo @echo "*** Making $(TARGET) hunspell dictionary ***" filter_plx_file $(TARGET) tmp/all-hsp-$(TARGET).sorted fix_set.py $(TARGET) $(TARGET)/hunspell # Before we compile the hunspell lexicons, we collect all pieces and sort them: tmp/all-hsp-$(TARGET).sorted: hsp-conversion \ properlist-hsp \ nounlist-hsp \ adjlist-hsp \ verblist-hsp @echo @echo "*** Sorting $(TARGET) files ***" @echo @if [ ! -d tmp/$(TARGET) ]; then \ mkdir tmp/$(TARGET) ; \ fi @egrep -v "^[0-9]" $(TARGET)/hunspell/num-$(TARGET).txt > \ $(TARGET)/hunspell/num-$(TARGET)-tmp.txt @mv -f $(TARGET)/hunspell/num-$(TARGET)-tmp.txt \ $(TARGET)/hunspell/num-$(TARGET).txt @LC_ALL=C sort -T tmp/$(TARGET) -u -o $@ \ $(HSPSRCjava) $(HSPSRCprefix) $(HSPSRCfst) # Here we make a full-form verb file # It requires network access to victorio.uit.no. verblist-hsp: $(TARGET)/hunspell/verb-$(TARGET).txt $(TARGET)/hunspell/verb-$(TARGET).txt: $(TARGET)/bin/spellerverbs-$(TARGET)-plx.fst common/bin/hyphen-remove.fst @echo @echo "*** Building $(TARGET) full-form verb list for hunspell conversion ***" @echo @rm -f $@ @printf "load stack < $(TARGET)/bin/spellerverbs-$(TARGET)-plx.fst \n\ load stack < common/bin/hyphen-remove.fst \n\ turn stack \n\ compose net \n\ lower-side \n\ print words \n\ quit \n" > tmp/verblist-$(TARGET)-hsp-script # $(SCP) tmp/verblist-$(TARGET)-hsp-script victorio.uit.no:speller-$(TARGET)/gt/tmp/ # $(SSH) victorio.uit.no "cd speller-$(TARGET)/gt && make TARGET=$(TARGET) common/bin/hyphen-remove.fst" # $(SSH) victorio.uit.no "cd speller-$(TARGET)/gt && make TARGET=$(TARGET) M4FLAGS=-DHUNSPELL $(TARGET)/bin/spellerverbs-$(TARGET)-plx.fst" $(UFST) -f tmp/verblist-$(TARGET)-hsp-script -q > $@ @rm -f tmp/verblist-$(TARGET)-hsp-script # Here we make a full-form adj file for hunspell conversion # It requires network access to victorio.uit.no. adjlist-hsp: $(TARGET)/hunspell/adj-$(TARGET).txt $(TARGET)/hunspell/adj-$(TARGET).txt: $(TARGET)/bin/spelleradjs-$(TARGET)-plx.fst common/bin/hyphen-remove.fst @echo @echo "*** Building $(TARGET) full-form adj list for hunspell conversion ***" @echo @rm -f $@ @printf "load stack < $(TARGET)/bin/spelleradjs-$(TARGET)-plx.fst \n\ load stack < common/bin/hyphen-remove.fst \n\ turn stack \n\ compose net \n\ lower-side \n\ print words \n\ quit \n" > tmp/adjlist-$(TARGET)-hsp-script # $(SCP) tmp/adjlist-$(TARGET)-hsp-script victorio.uit.no:speller-$(TARGET)/gt/tmp/ # $(SSH) victorio.uit.no "cd speller-$(TARGET)/gt && make TARGET=$(TARGET) common/bin/hyphen-remove.fst" # $(SSH) victorio.uit.no "cd speller-$(TARGET)/gt && make TARGET=$(TARGET) M4FLAGS=-DHUNSPELL $(TARGET)/bin/spelleradjs-$(TARGET)-plx.fst" $(UFST) -f tmp/adjlist-$(TARGET)-hsp-script -q > $@ @rm -f tmp/adjlist-$(TARGET)-hsp-script # Here we make a full-form noun file for hunspell conversion # It requires network access to victorio.uit.no. nounlist-hsp: $(TARGET)/hunspell/noun-$(TARGET).txt $(TARGET)/hunspell/noun-$(TARGET).txt: $(TARGET)/bin/spellernouns-$(TARGET)-plx.fst common/bin/hyphen-remove.fst @echo @echo "*** Building $(TARGET) full-form noun list for hunspell conversion ***" @echo @rm -f $@ @printf "load stack < $(TARGET)/bin/spellernouns-$(TARGET)-plx.fst \n\ load stack < common/bin/hyphen-remove.fst \n\ turn stack \n\ compose net \n\ lower-side \n\ print words \n\ quit \n" > tmp/nounlist-$(TARGET)-hsp-script # $(SCP) tmp/nounlist-$(TARGET)-hsp-script victorio.uit.no:speller-$(TARGET)/gt/tmp/ # $(SSH) victorio.uit.no "cd speller-$(TARGET)/gt && make TARGET=$(TARGET) common/bin/hyphen-remove.fst" # $(SSH) victorio.uit.no "cd speller-$(TARGET)/gt && make TARGET=$(TARGET) M4FLAGS=-DHUNSPELL $(TARGET)/bin/spellernouns-$(TARGET)-plx.fst" $(UFST) -f tmp/nounlist-$(TARGET)-hsp-script -q > $@ @rm -f tmp/nounlist-$(TARGET)-hsp-script # Here we make a full-form propernoun file # It requires network access to victorio.uit.no. properlist-hsp: $(TARGET)/hunspell/propernoun-$(TARGET).txt $(TARGET)/hunspell/propernoun-$(TARGET).txt: $(TARGET)/bin/spellerproper-$(TARGET)-plx.fst common/bin/hyphen-remove.fst @echo @echo "*** Building $(TARGET) full-form propernoun list for hunspell conversion ***" @echo @rm -f $@ @printf "load stack < $(TARGET)/bin/spellerproper-$(TARGET)-plx.fst \n\ load stack < common/bin/hyphen-remove.fst \n\ turn stack \n\ compose net \n\ lower-side \n\ print words \n\ quit \n" > tmp/properlist-$(TARGET)-hsp-script # $(SCP) tmp/properlist-$(TARGET)-hsp-script victorio.uit.no:speller-$(TARGET)/gt/tmp/ # $(SSH) victorio.uit.no "cd speller-$(TARGET)/gt && make TARGET=$(TARGET) common/bin/hyphen-remove.fst" # $(SSH) victorio.uit.no "cd speller-$(TARGET)/gt && make TARGET=$(TARGET) M4FLAGS=-DHUNSPELL $(TARGET)/bin/spellerproper-$(TARGET)-plx.fst" $(UFST) -f tmp/properlist-$(TARGET)-hsp-script -q > $@ @rm -f tmp/properlist-$(TARGET)-hsp-script hsp-conversion: ifst-norm lexc2xspell $(HSPSRCjava) $(HSPSRCprefix) $(HSPSRCjava): $(SRCS) lexc2xspell $(TARGET)/src/num-$(TARGET)-lex.txt @echo @echo "*** Creating $(TARGET) HSP files ***" @echo java -cp src/lexc2xspell/build Lexc2xspell \ $(patsubst $(TARGET)/hunspell/%.txt,$(TARGET)/src/%-lex.txt,$@) \ `pwd`/$(TARGET)/bin/i$(TARGET)-norm.fst \ | sed -e 's/\^//g' -e 's/#//g' | uniq > $@ $(HSPSRCprefix): $(HSPJavaMiddle) @echo @echo "*** Creating $(TARGET) HSP prefix file ***" @echo java -cp src/lexc2xspell/build Lexc2xspell \ $(TARGET)/src/$(TARGET)-lex.txt \ `pwd`/$(TARGET)/bin/i$(TARGET)-norm.fst \ | sed -e 's/\^//g' -e 's/#//g' | uniq > $@ java -cp src/lexc2xspell/build Lexc2xspell \ $(TARGET)/src/noun-$(TARGET)-lex.txt \ `pwd`/$(TARGET)/bin/i$(TARGET)-norm.fst \ | sed -e 's/\^//g' -e 's/#//g' | uniq >> $@