## Process this file with automake to produce Makefile.in ## Copyright (C) 2011 Samediggi ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . # Hfst fst variables: GT_SPELLER_SRC_HFST=generator-speller-gt-norm.hfst GT_COMMON_SPELLER_HFST= ## Conditional string variables; # Set file name to the empty string or initial_letters_all depending on variable: tag_weighted_dep=$(shell \ if [[ $(ENABLE_CORPUS_WEIGHTS) == 'yes' ]] ; \ then \ echo "%-unit_weighted.hfst"; \ else \ echo "%-comp_restricted.hfst"; \ fi) ####### Automake targets: ######## if WANT_SPELLERS if CAN_HFST GT_COMMON_SPELLER_HFST+=generator-fstspeller-gt-norm.hfst GT_COMMON_SPELLER_HFST+=analyser-fstspeller-gt-norm.hfst endif # CAN_HFST endif # WANT_SPELLERS noinst_DATA=$(GT_COMMON_SPELLER_HFST) $(GT_COMMON_SPELLER_XFST) #### 1. Build the speller transducer with compound filtering: generator-fstspeller-gt-norm-comp_restricted.tmp.hfst: \ ../$(GT_SPELLER_SRC_HFST) \ $(top_builddir)/src/filters/remove-hyphenation-marks.hfst \ $(top_builddir)/src/filters/remove-infl_deriv-borders.hfst \ $(top_builddir)/src/filters/convert_to_flags-CmpNP-tags.hfst \ $(top_builddir)/src/filters/split-CmpNP-tags.hfst $(AM_V_HXFST)$(PRINTF) "read regex \ @\"$(top_builddir)/src/filters/convert_to_flags-CmpNP-tags.hfst\" \ .o. @\"$(top_builddir)/src/filters/split-CmpNP-tags.hfst\" \ .o. @\"$<\" \ .o. @\"$(top_builddir)/src/filters/remove-hyphenation-marks.hfst\" \ .o. @\"$(top_builddir)/src/filters/remove-infl_deriv-borders.hfst\" \ ; \n\ twosided flag-diacritics\n\ save stack $@\n\ quit\n" | $(HFST_XFST) -p $(VERBOSITY) #### 2. Add corpus-based frequency weights (all non-hits will disappear from #### the fst): %-freq_weighted.hfst: %-comp_restricted.hfst \ $(SURFWEIGHTS) $(AM_V_COMPOSE)$(HFST_COMPOSE) $(HFST_FLAGS) -F \ $< $(SURFWEIGHTS) \ -o $@ #### 3. Add a default unit weight to anything not covered by the corpus #### by combining (unioning) the unitweighted.hfst (which is the full #### lexical fst) with the frequency/corpus-based fst: %-unit_weighted.hfst: %-freq_weighted.hfst \ unitweighted.hfst $(AM_V_UNION)$(HFST_DISJUNCT) $(HFST_FLAGS) $< unitweighted.hfst \ -o $@ #### 4. Add tag-based weights, for adjusting weights according to morphology #### and other tag-based penalties like words that should not be suggested: %-tag_weighted.hfst: $(tag_weighted_dep) \ $(srcdir)/weighting/$(TAGWEIGHTS) $(AM_V_REWEIGHT)$(HFST_REWEIGHT) $(MORE_VERBOSITY) $(HFST_FLAGS) \ -T $(srcdir)/weighting/$(TAGWEIGHTS) --arcs-only -i $< \ -o $@ #### 5. Finally, remove the surface word boundary symbol and do other #### general cleanup: %.tmp.hfst: %-tag_weighted.hfst \ $(top_builddir)/src/filters/remove-word-boundary.hfst \ $(top_builddir)/src/filters/remove-usage-tags.hfst \ $(top_builddir)/src/filters/remove-derivation-position-tags.hfst $(AM_V_HXFST)$(PRINTF) "\ set encode-weights ON \n\ read regex \ @\"$(top_builddir)/src/filters/remove-usage-tags.hfst\" \ .o. @\"$(top_builddir)/src/filters/remove-derivation-position-tags.hfst\" \ .o. @\"$<\" \ .o. @\"$(top_builddir)/src/filters/remove-word-boundary.hfst\" \ ; \n\ save stack $@\n\ quit\n" | $(HFST_XFST) -p $(MORE_VERBOSITY) # Copy the tmp transducer to the final one. This allows local overrides. %.hfst: %.tmp.hfst $(AM_V_CP)cp -f $< $@ # Invert the final fst, to enable symmetric yaml tests and easy manual testing: analyser-%.hfst: generator-%.hfst $(AM_V_INVERT)$(HFST_INVERT) $(MORE_VERBOSITY) $(HFST_FLAGS) -i $< -o $@ ####### Other targets: ########### clean-local: -rm -f *.hfst *.txt include $(top_srcdir)/am-shared/tools-spellcheckers-fstbased_weights-dir-include.am include $(top_srcdir)/am-shared/silent_build-include.am