Skip to content

Commit

Permalink
fixes to autoinited stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommi A Pirinen committed Apr 27, 2016
1 parent 5290199 commit e1f4494
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 50 deletions.
76 changes: 30 additions & 46 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
###############################################################################
## Makefile for apertium-nio
###############################################################################

RELEASE=0.1
VERSION=0.1.0
RELEASE=0.0
VERSION=0.0.0
LANG1=nio
BASENAME=apertium-$(LANG1)

LEXCFLAGS=-v --Werror

TARGETS_COMMON = \
$(LANG1).automorf.hfst \
$(LANG1).automorf.bin \
Expand All @@ -20,12 +20,10 @@ TARGETS_COMMON = \
# This include defines goals for install-modes, .deps/.d, autobil.prefixes and .mode files:
@ap_include@

###############################################################################
## nio transducer
###############################################################################

.deps/$(LANG1).twol.hfst: $(BASENAME).$(LANG1).twol .deps/.d
hfst-twolc $< -o $@
$(HFSTTWOLC) $< -o $@

.deps/$(LANG1).RL.lexc: $(BASENAME).$(LANG1).lexc .deps/.d
cat $< | grep -v 'Dir/LR' > $@
Expand All @@ -34,94 +32,86 @@ TARGETS_COMMON = \
cat $< | grep -v 'Dir/RL' > $@

.deps/$(LANG1).RL.lexc.hfst: .deps/$(LANG1).RL.lexc
hfst-lexc $< -o $@ -v
$(HFSTLEXC) $< -o $@ $(LEXCFLAGS)

.deps/$(LANG1).LR.lexc.hfst: .deps/$(LANG1).LR.lexc
hfst-lexc $< -o $@ -v
$(HFSTLEXC) $< -o $@ $(LEXCFLAGS)

.deps/$(LANG1).RL.hfst: .deps/$(LANG1).RL.lexc.hfst .deps/$(LANG1).twol.hfst
hfst-compose-intersect -1 .deps/$(LANG1).RL.lexc.hfst -2 .deps/$(LANG1).twol.hfst -o $@
$(HFSTCOMPINT) -1 .deps/$(LANG1).RL.lexc.hfst -2 .deps/$(LANG1).twol.hfst -o $@

.deps/$(LANG1).LR.hfst: .deps/$(LANG1).LR.lexc.hfst .deps/$(LANG1).twol.hfst
hfst-compose-intersect -1 .deps/$(LANG1).LR.lexc.hfst -2 .deps/$(LANG1).twol.hfst -o $@
$(HFSTCOMPINT) -1 .deps/$(LANG1).LR.lexc.hfst -2 .deps/$(LANG1).twol.hfst -o $@

$(LANG1).autogen.hfst: .deps/$(LANG1).RL.hfst
hfst-fst2fst -O $< -o $@
$(HFSTF2F) -O $< -o $@

$(LANG1).automorf.hfst: .deps/$(LANG1).LR.hfst
hfst-invert $< | hfst-fst2fst -O -o $@
$(HFSTINV) $< | $(HFSTF2F) -O -o $@

$(LANG1).autogen.att.gz: $(LANG1).autogen.hfst
hfst-fst2txt $< | gzip -9 -c -n > $@
$(HFSTF2T) $< | gzip -9 -c -n > $@

$(LANG1).automorf.att.gz: $(LANG1).automorf.hfst
hfst-fst2txt $< | gzip -9 -c -n > $@
$(HFSTF2T) $< | gzip -9 -c -n > $@

$(LANG1).autogen.bin: $(LANG1).autogen.att.gz .deps/.d
zcat < $< > .deps/$(LANG1).autogen.att
lt-comp lr .deps/$(LANG1).autogen.att $@
$(LTCOMP) lr .deps/$(LANG1).autogen.att $@

$(LANG1).automorf.bin: $(LANG1).automorf.att.gz .deps/.d
zcat < $< > .deps/$(LANG1).automorf.att
lt-comp lr .deps/$(LANG1).automorf.att $@
$(LTCOMP) lr .deps/$(LANG1).automorf.att $@

$(LANG1).autopgen.bin: $(BASENAME).post-$(LANG1).dix
lt-comp lr $< $@
$(LTCOMP) lr $< $@

###############################################################################
## Debugging transducers (for testvoc)
###############################################################################

debug: .deps/$(LANG1).LR-debug.hfst .deps/$(LANG1).lexc.hfst

.deps/$(LANG1).LR-debug.hfst: $(BASENAME).$(LANG1).lexc .deps/.d
cat $< | grep -v 'Dir/RL' | grep -v 'Use/Circ' > .deps/$(LANG1).LR-debug.lexc
hfst-lexc .deps/$(LANG1).LR-debug.lexc -o .deps/$(LANG1).LR-debug.lexc.hfst -v
hfst-compose-intersect -1 .deps/$(LANG1).LR-debug.lexc.hfst -2 .deps/$(LANG1).twol.hfst -o $@
$(HFSTLEXC) .deps/$(LANG1).LR-debug.lexc -o .deps/$(LANG1).LR-debug.lexc.hfst -v
$(HFSTCOMPINT) -1 .deps/$(LANG1).LR-debug.lexc.hfst -2 .deps/$(LANG1).twol.hfst -o $@

.deps/$(LANG1).lexc.hfst: .deps/$(LANG1).RL.lexc.hfst
hfst-fst2fst -O -i $< -o $@
$(HFSTF2F) -O -i $< -o $@

###############################################################################
## Disambiguation rules
###############################################################################

$(LANG1).rlx.bin: $(BASENAME).$(LANG1).rlx $(CGCOMP)
$(CGCOMP) $< $@

###############################################################################
## Spell checker
###############################################################################

$(LANG1).zhfst: .deps/acceptor.default.hfst .deps/errmodel.default.hfst
rm -f $@
zip -j $@ .deps/acceptor.default.hfst .deps/errmodel.default.hfst speller/index.xml

.deps/errmodel.default.hfst: .deps/words.default.hfst .deps/strings.default.hfst
python dev/editdist.py -v -s -d 1 -e '@0@' -i speller/editdist.default.txt -a .deps/acceptor.default.hfst \
| hfst-txt2fst -e '@0@' -o .deps/editdist.default.hfst
hfst-disjunct .deps/strings.default.hfst .deps/editdist.default.hfst \
| hfst-minimise | hfst-repeat -f 1 -t 2 -o .deps/editstrings.default.hfst
hfst-disjunct .deps/words.default.hfst .deps/editstrings.default.hfst \
| hfst-fst2fst -f olw -o $@
$(PYTHON) dev/editdist.py -v -s -d 1 -e '@0@' -i speller/editdist.default.txt -a .deps/acceptor.default.hfst \
| $(HFSTT2F) -e '@0@' -o .deps/editdist.default.hfst
$(HFSTDIS) .deps/strings.default.hfst .deps/editdist.default.hfst \
| $(HFSTMIN) | $(HFSTREP) -f 1 -t 2 -o .deps/editstrings.default.hfst
$(HFSTDIS) .deps/words.default.hfst .deps/editstrings.default.hfst \
| $(HFSTF2F) -f olw -o $@

.deps/words.default.hfst: speller/words.default.txt
grep -v -e "^#" -e "^$$" $< | hfst-strings2fst -j -o $@
grep -v -e "^#" -e "^$$" $< | $(HFSTS2F) -j -o $@

.deps/strings.default.hfst: speller/strings.default.txt .deps/anystar.hfst
grep -v -e "^#" -e "^$$" $< | hfst-strings2fst -j | hfst-concatenate .deps/anystar.hfst - |\
hfst-concatenate - .deps/anystar.hfst -o $@
grep -v -e "^#" -e "^$$" $< | $(HFSTS2F) -j | $(HFSTCAT) .deps/anystar.hfst - |\
$(HFSTCAT) - .deps/anystar.hfst -o $@

.deps/anystar.hfst:
echo "?*;" | hfst-regexp2fst -S -o $@
echo "?*;" | $(HFSTR2F) -S -o $@

.deps/acceptor.default.hfst: $(LANG1).autogen.hfst
cat $< | hfst-fst2fst -t | hfst-project --project=lower | hfst-minimise |hfst-fst2fst -f olw -o $@
cat $< | $(HFSTF2F) -t | $(HFSTPROJ) --project=lower | $(HFSTMIN) |$(HFSTF2F) -f olw -o $@


###############################################################################
## Distribution
###############################################################################

EXTRA_DIST=$(BASENAME).$(LANG1).lexc \
$(BASENAME).$(LANG1).twol \
Expand All @@ -130,9 +120,7 @@ EXTRA_DIST=$(BASENAME).$(LANG1).lexc \
$(LANG1).prob \
modes.xml

###############################################################################
## Installation stuff
###############################################################################
#
# apertium_nio_dir: This is where the compiled binaries go
# apertium_nio_srcdir: This is where the source files go
Expand Down Expand Up @@ -160,17 +148,13 @@ install-data-local:
$(INSTALL_DATA) $(BASENAME).$(LANG1).rlx $(DESTDIR)$(apertium_nio_srcdir)
$(INSTALL_DATA) $(BASENAME).post-$(LANG1).dix $(DESTDIR)$(apertium_nio_srcdir)

###############################################################################
## Cleanup
###############################################################################

CLEANFILES = $(TARGETS_COMMON)
clean-local:
-rm -rf .deps modes

###############################################################################
## Test
###############################################################################

test: all
echo "TODO test sentence" | apertium -d . nio-morph | tee .test-mt
Expand Down
35 changes: 31 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AC_PREREQ(2.52)

AC_INIT([Apertium {{languageName1}}-{{languageName2}}], [0.1.0], [tommi.antero.pirinen@uni-hamburg.de], [apertium-{{languageCode1}}-{{languageCode2}}], [http://wiki.apertium.org/wiki/Apertium-{{languageCode1}}-{{languageCode2}}])
AC_INIT([apertium-nio], [0.0.0], [flammie@iki.fi], [apertium-nio], [http://wiki.apertium.org/wiki/Apertium-nio])
AM_INIT_AUTOMAKE

AC_PROG_LN_S
Expand All @@ -19,18 +19,45 @@ AS_IF([test x$hfstospell = xyes], [
CXXFLAGS="$CXXFLAGS $HFSTOSPELL_CFLAGS"
])
AM_CONDITIONAL([HAVE_HFSTOSPELL], [test x$hfstospell = xyes])
AM_PATH_PYTHON([3.2],, [:])


m4_define([required_apertium_version], [3.4.0])
PKG_CHECK_MODULES(APERTIUM, apertium >= required_apertium_version)

AC_PATH_PROG([HFSTLEXC], [hfst-lexc], [false], [$PATH$PATH_SEPARATOR$with_hfst_lexc/bin])
AC_PATH_PROG([HFSTLEXC], [hfst-lexc], [false])
AS_IF([test x$HFSTLEXC = xfalse], [AC_MSG_ERROR([You don't have hfst-lexc installed])])

AC_PATH_PROG([HFSTTWOLC], [hfst-twolc], [false], [$PATH$PATH_SEPARATOR$with_hfst_twolc/bin])
AC_PATH_PROG([HFSTTWOLC], [hfst-twolc], [false])
AS_IF([test x$HFSTTWOLC = xfalse], [AC_MSG_ERROR([You don't have hfst-twolc installed])])

AC_PATH_PROG([CGCOMP], [cg-comp], [false], [$PATH$PATH_SEPARATOR$with_cg_comp/bin])
AC_PATH_PROG([HFSTCOMPINT], [hfst-compose-intersect], [false])
AS_IF([test x$HFSTCOMPINT = xfalse], [AC_MSG_ERROR([You don't have hfst])])
AC_PATH_PROG([HFSTF2F], [hfst-fst2fst], [false])
AS_IF([test x$HFSTF2F = xfalse], [AC_MSG_ERROR([You don't have hfst])])
AC_PATH_PROG([HFSTT2F], [hfst-txt2fst], [false])
AS_IF([test x$HFSTT2F = xfalse], [AC_MSG_ERROR([You don't have hfst])])
AC_PATH_PROG([HFSTF2T], [hfst-fst2txt], [false])
AS_IF([test x$HFSTF2T = xfalse], [AC_MSG_ERROR([You don't have hfst])])
AC_PATH_PROG([HFSTMIN], [hfst-minimise], [false])
AS_IF([test x$HFSTMIN = xfalse], [AC_MSG_ERROR([You don't have hfst])])
AC_PATH_PROG([HFSTDIS], [hfst-disjunct], [false])
AS_IF([test x$HFSTDIS = xfalse], [AC_MSG_ERROR([You don't have hfst])])
AC_PATH_PROG([HFSTS2F], [hfst-strings2fst], [false])
AS_IF([test x$HFSTS2F = xfalse], [AC_MSG_ERROR([You don't have hfst])])
AC_PATH_PROG([HFSTR2F], [hfst-regexp2fst], [false])
AS_IF([test x$HFSTR2F = xfalse], [AC_MSG_ERROR([You don't have hfst])])
AC_PATH_PROG([HFSTINV], [hfst-invert], [false])
AS_IF([test x$HFSTS2F = xfalse], [AC_MSG_ERROR([You don't have hfst])])
AC_PATH_PROG([HFSTCAT], [hfst-concatenate], [false])
AS_IF([test x$HFSTS2F = xfalse], [AC_MSG_ERROR([You don't have hfst])])
AC_PATH_PROG([HFSTPROJ], [hfst-project], [false])
AS_IF([test x$HFSTPROJ = xfalse], [AC_MSG_ERROR([You don't have hfst])])


AC_PATH_PROG([LTCOMP], [lt-comp], [false])
AS_IF([test x$LTCOMP = xfalse], [AC_MSG_ERROR([You don't have lt-comp installed])])
AC_PATH_PROG([CGCOMP], [cg-comp], [false])
AS_IF([test x$CGCOMP = xfalse], [AC_MSG_ERROR([You don't have cg-comp installed])])


Expand Down

0 comments on commit e1f4494

Please sign in to comment.