diff --git a/swig/Makefile b/swig/Makefile index 241f1f451bf6589108bc5437b8dd77462620e866..88e2d712dafcf48cc94ad904dd3ffe50bddca960 100644 --- a/swig/Makefile +++ b/swig/Makefile @@ -35,7 +35,8 @@ CBIN=libcclvalue.o \ libcclactionexeccontext.o \ libccltagaction.o \ libccltagrule.o \ - libccltagrulesequence.o + libccltagrulesequence.o \ + libcclmatchrule.o CBINOUT=_libcclvalue.so \ _libcclstrset.so \ @@ -58,6 +59,7 @@ CBINOUT=_libcclvalue.so \ _libccltagaction.so \ _libccltagrule.so \ _libccltagrulesequence.so \ + _libcclmatchrule.so \ _boost_shared_ptr.so CWRAP=libcclvalue_wrap.cxx \ @@ -82,6 +84,7 @@ CWRAP=libcclvalue_wrap.cxx \ libccltagaction_wrap.cxx \ libccltagrule_wrap.cxx \ libccltagrulesequence_wrap.cxx \ + libcclmatchrule_wrap.cxx \ boost_shared_ptr_wrap.cxx CWRAPBIN=libcclvalue_wrap.o \ @@ -105,6 +108,7 @@ CWRAPBIN=libcclvalue_wrap.o \ libccltagaction_wrap.o \ libccltagrule_wrap.o \ libccltagrulesequence_wrap.o \ + libcclmatchrule_wrap.o \ boost_shared_ptr_wrap.o PYMODULES=libcclvalue.py \ @@ -128,6 +132,7 @@ PYMODULES=libcclvalue.py \ libccltagaction.py \ libccltagrule.py \ libccltagrulesequence.py \ + libcclmatchrule.py \ boost_shared_ptr.py PYCBIN=libcclvalue.pyc \ @@ -151,6 +156,7 @@ PYCBIN=libcclvalue.pyc \ libccltagaction.pyc \ libccltagrule.pyc \ libccltagrulesequence.pyc \ + libcclmatchrule.pyc \ boost_shared_ptr.pyc all:boost_shared_ptr.o $(CBIN) @@ -323,6 +329,13 @@ libccltagrulesequence.o: $(CPP) -shared libccltagrulesequence_wrap.o \ $(CCLBIN) $(ANTLRLIB) -o _libccltagrulesequence.so +# MatchRule +libcclmatchrule.o: + $(SWIG) $(SWIGOPTS_LANG) libcclmatchrule.i + $(CPP) -c libcclmatchrule_wrap.cxx -I$(PYTHONDIR) -I$(WCCLDIR) $(CPPFLAGS) + $(CPP) -shared libcclmatchrule_wrap.o \ + $(CCLBIN) $(ANTLRLIB) -o _libcclmatchrule.so + # ----------------------------------------------------------------------------- clean: rm -f $(CBIN) $(CBINOUT) $(CWRAP) $(CWRAPBIN) $(PYMODULES) $(PYCBIN) diff --git a/swig/libcclmatchrule.i b/swig/libcclmatchrule.i new file mode 100644 index 0000000000000000000000000000000000000000..f2ca44c1761436396a7553bfe05e7611e97b73ce --- /dev/null +++ b/swig/libcclmatchrule.i @@ -0,0 +1,55 @@ +#ifndef SWIG_LIBWCCL_MATCHRULE_I +#define SWIG_LIBWCCL_MATCHRULE_I + +%module libcclmatchrule +%{ + #include <libwccl/ops/matchrule.h> +%} + +%include "libcclvariables.i" +%include "libcclparsedexpression.i" +%include "libcorpus/libcorpusannotatedsentence.i" + +%include "std_string.i" +%include "boost_shared_ptr.i" + +namespace Wccl { + class MatchRule : public ParsedExpression { + public: + MatchRule( + const Variables& variables, + const boost::shared_ptr<ApplyOperator>& apply + ); + + MatchRule(const MatchRule& other, bool clean = false); + MatchRule(); + + /* --------------------------------------------------------------------- */ + + %rename(OpFunMatchRule) operator()(const boost::shared_ptr<Corpus2::AnnotatedSentence>& s); + void operator()(const boost::shared_ptr<Corpus2::AnnotatedSentence>& s); + + void apply(const boost::shared_ptr<Corpus2::AnnotatedSentence>& s); + + /* --------------------------------------------------------------------- */ + + MatchRule clone() const; + MatchRule clone_clean() const; + + boost::shared_ptr<MatchRule> clone_ptr() const; + boost::shared_ptr<MatchRule> clone_clean_ptr() const; + + /* --------------------------------------------------------------------- */ + + %rename(OpEqMatchRule) *::operator=(const MatchRule& other); + + /* --------------------------------------------------------------------- */ + + std::string to_string(const Corpus2::Tagset& tagset) const; + }; +} + +using namespace std; +using namespace Wccl; + +#endif /* SWIG_LIBWCCL_MATCHRULE_I */