From 29c93ee69d4507eee05b7693e5a781643e8339d4 Mon Sep 17 00:00:00 2001 From: "jon.h.clark" Date: Fri, 12 Nov 2010 20:22:56 +0000 Subject: Gross hack for compiling GLC as a library. Currently has hardcoded path, but shouldn't break the build. git-svn-id: https://ws10smt.googlecode.com/svn/trunk@716 ec762483-ff6d-05da-a07a-a48fb63a330f --- configure.ac | 27 +++++++++++++++++++++++++++ decoder/Makefile.am | 7 ++++++- decoder/cdec_ff.cc | 9 +++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1a87d323..3fb4ef47 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,14 @@ AC_ARG_WITH(randlm, [with_randlm=no] ) +AM_CONDITIONAL([GLC], false) +AC_ARG_WITH(glc, + [AC_HELP_STRING([--with-glc=PATH], [(optional) path to Global Lexical Coherence package (Context CRF)])], + [with_glc=$withval], + [with_glc=no] + ) +FF_GLC="" + if test "x$with_srilm" != 'xno' then SAVE_CPPFLAGS="$CPPFLAGS" @@ -87,4 +95,23 @@ then AM_CONDITIONAL([RAND_LM], true) fi + +if test "x$with_glc" != 'xno' +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I${with_glc} -I${with_glc}/cdec" + + #AC_CHECK_HEADER(ff_glc.h, + # [AC_DEFINE([HAVE_GLC], [], [flag for GLC])], + # [AC_MSG_ERROR([Cannot find GLC!])]) + + AC_DEFINE([HAVE_GLC], [], [flag for GLC]) + #LIB_RANDLM="-lrandlm" + #LDFLAGS="$LDFLAGS -L${with_glc}/lib" + #LIBS="$LIBS $LIB_RANDLM" + #FMTLIBS="$FMTLIBS libglc.a" + AC_SUBST(FF_GLC,"${with_glc}/cdec/ff_glc.cc") + AM_CONDITIONAL([GLC], true) +fi + AC_OUTPUT(Makefile utils/Makefile mteval/Makefile extools/Makefile decoder/Makefile training/Makefile vest/Makefile klm/util/Makefile klm/lm/Makefile gi/pyp-topics/src/Makefile gi/clda/src/Makefile) diff --git a/decoder/Makefile.am b/decoder/Makefile.am index ea01a4da..4c688180 100644 --- a/decoder/Makefile.am +++ b/decoder/Makefile.am @@ -26,7 +26,6 @@ hg_test_SOURCES = hg_test.cc hg_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz trule_test_SOURCES = trule_test.cc trule_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz - AM_CPPFLAGS = -W -Wall -Wno-sign-compare $(GTEST_CPPFLAGS) -I.. -I../mteval -I../utils -I../klm rule_lexer.cc: rule_lexer.l @@ -58,6 +57,7 @@ libcdec_a_SOURCES = \ phrasetable_fst.cc \ trule.cc \ ff.cc \ + ff_wordset.cc \ ff_lm.cc \ ff_klm.cc \ ff_ruleshape.cc \ @@ -75,3 +75,8 @@ libcdec_a_SOURCES = \ JSON_parser.c \ json_parse.cc \ grammar.cc + +if GLC + # Until we build GLC as a library... + libcdec_a_SOURCES += ff_glc.cc +endif \ No newline at end of file diff --git a/decoder/cdec_ff.cc b/decoder/cdec_ff.cc index 09a19a7b..3953118c 100644 --- a/decoder/cdec_ff.cc +++ b/decoder/cdec_ff.cc @@ -12,6 +12,11 @@ #include "ff_lm_fsa.h" #include "ff_sample_fsa.h" #include "ff_register.h" +#include "ff_wordset.h" + +#ifdef HAVE_GLC +#include +#endif void register_feature_functions() { static bool registered = false; @@ -59,5 +64,9 @@ void register_feature_functions() { ff_registry.Register("OutputIdentity", new FFFactory); ff_registry.Register("InputIdentity", new FFFactory); ff_registry.Register("LexicalTranslationTrigger", new FFFactory); + ff_registry.Register("WordSet", new FFFactory); +#ifdef HAVE_GLC + ff_registry.Register("ContextCRF", new FFFactory); +#endif } -- cgit v1.2.3