Skip to content
Snippets Groups Projects
Commit d68f1e0b authored by Paweł Kędzia's avatar Paweł Kędzia
Browse files

(swig) Added wrapper for Wccl::TagRule

parent bd77e608
Branches
No related merge requests found
...@@ -33,7 +33,8 @@ CBIN=libcclvalue.o \ ...@@ -33,7 +33,8 @@ CBIN=libcclvalue.o \
libcclsentencecontext.o \ libcclsentencecontext.o \
libcclparser.o \ libcclparser.o \
libcclactionexeccontext.o \ libcclactionexeccontext.o \
libccltagaction.o libccltagaction.o \
libccltagrule.o
CBINOUT=_libcclvalue.so \ CBINOUT=_libcclvalue.so \
_libcclstrset.so \ _libcclstrset.so \
...@@ -54,6 +55,7 @@ CBINOUT=_libcclvalue.so \ ...@@ -54,6 +55,7 @@ CBINOUT=_libcclvalue.so \
_libcclparser.so \ _libcclparser.so \
_libcclactionexeccontext.so \ _libcclactionexeccontext.so \
_libccltagaction.so \ _libccltagaction.so \
_libccltagrule.so \
_boost_shared_ptr.so _boost_shared_ptr.so
CWRAP=libcclvalue_wrap.cxx \ CWRAP=libcclvalue_wrap.cxx \
...@@ -76,6 +78,7 @@ CWRAP=libcclvalue_wrap.cxx \ ...@@ -76,6 +78,7 @@ CWRAP=libcclvalue_wrap.cxx \
libcclparser_wrap.cxx \ libcclparser_wrap.cxx \
libcclactionexeccontext_wrap.cxx \ libcclactionexeccontext_wrap.cxx \
libccltagaction_wrap.cxx \ libccltagaction_wrap.cxx \
libccltagrule_wrap.cxx \
boost_shared_ptr_wrap.cxx boost_shared_ptr_wrap.cxx
CWRAPBIN=libcclvalue_wrap.o \ CWRAPBIN=libcclvalue_wrap.o \
...@@ -97,6 +100,7 @@ CWRAPBIN=libcclvalue_wrap.o \ ...@@ -97,6 +100,7 @@ CWRAPBIN=libcclvalue_wrap.o \
libcclparser_wrap.o \ libcclparser_wrap.o \
libcclactionexeccontext_wrap.o \ libcclactionexeccontext_wrap.o \
libccltagaction_wrap.o \ libccltagaction_wrap.o \
libccltagrule_wrap.o \
boost_shared_ptr_wrap.o boost_shared_ptr_wrap.o
PYMODULES=libcclvalue.py \ PYMODULES=libcclvalue.py \
...@@ -118,6 +122,7 @@ PYMODULES=libcclvalue.py \ ...@@ -118,6 +122,7 @@ PYMODULES=libcclvalue.py \
libcclparser.py \ libcclparser.py \
libcclactionexeccontext.py \ libcclactionexeccontext.py \
libccltagaction.py \ libccltagaction.py \
libccltagrule.py \
boost_shared_ptr.py boost_shared_ptr.py
PYCBIN=libcclvalue.pyc \ PYCBIN=libcclvalue.pyc \
...@@ -139,6 +144,7 @@ PYCBIN=libcclvalue.pyc \ ...@@ -139,6 +144,7 @@ PYCBIN=libcclvalue.pyc \
libcclparser.pyc \ libcclparser.pyc \
libcclactionexeccontext.pyc \ libcclactionexeccontext.pyc \
libccltagaction.pyc \ libccltagaction.pyc \
libccltagrule.pyc \
boost_shared_ptr.pyc boost_shared_ptr.pyc
all:boost_shared_ptr.o $(CBIN) all:boost_shared_ptr.o $(CBIN)
...@@ -297,6 +303,13 @@ libccltagaction.o: ...@@ -297,6 +303,13 @@ libccltagaction.o:
$(CPP) -shared libccltagaction_wrap.o \ $(CPP) -shared libccltagaction_wrap.o \
$(CCLBIN) $(ANTLRLIB) -o _libccltagaction.so $(CCLBIN) $(ANTLRLIB) -o _libccltagaction.so
# TagRule
libccltagrule.o:
$(SWIG) $(SWIGOPTS_LANG) libccltagrule.i
$(CPP) -c libccltagrule_wrap.cxx -I$(PYTHONDIR) -I$(WCCLDIR) $(CPPFLAGS)
$(CPP) -shared libccltagrule_wrap.o \
$(CCLBIN) $(ANTLRLIB) -o _libccltagrule.so
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
clean: clean:
rm -f $(CBIN) $(CBINOUT) $(CWRAP) $(CWRAPBIN) $(PYMODULES) $(PYCBIN) rm -f $(CBIN) $(CBINOUT) $(CWRAP) $(CWRAPBIN) $(PYMODULES) $(PYCBIN)
#ifndef SWIG_LIBWCCL_TAGRULE_I
#define SWIG_LIBWCCL_TAGRULE_I
%module libccltagrule
%{
#include <libwccl/ops/tagrule.h>
%}
%include "libcclbool.i"
%include "libccltagaction.i"
%include "libcclvariables.i"
%include "libcclsentencecontext.i"
%include "libcclparsedexpression.i"
%include "libcorpus/libcorpustagset.i"
%include "std_string.i"
%include "boost_shared_ptr.i"
%template(TagRulePtr) boost::shared_ptr<Wccl::TagRule>;
namespace Wccl {
class TagRule : public ParsedExpression {
public:
/*
TagRule(
const std::string& name,
const Variables& variables,
const boost::shared_ptr<const std::vector<boost::shared_ptr<TagAction> > >& actions,
const boost::shared_ptr<const Function<Bool> >& condition = TrueCondition()
);
*/
TagRule();
TagRule(const TagRule& other, bool clean = false);
/* --------------------------------------------------------------------- */
%rename(OpFunTagRule) operator()(const SentenceContext& sentence_context);
Bool operator()(SentenceContext& sentence_context);
/* --------------------------------------------------------------------- */
Bool execute(SentenceContext& sentence_context);
std::string name() const;
/* --------------------------------------------------------------------- */
TagRule clone() const;
TagRule clone_clean() const;
/* --------------------------------------------------------------------- */
boost::shared_ptr<TagRule> clone_ptr() const;
boost::shared_ptr<TagRule> clone_clean_ptr() const;
/* --------------------------------------------------------------------- */
%rename(OperatorEqTagRule) *::operator=(const TagRule& other);
/* --------------------------------------------------------------------- */
std::string to_string(const Corpus2::Tagset& tagset) const;
/* --------------------------------------------------------------------- */
protected:
TagRule* clone_internal() const;
private:
// static const boost::shared_ptr<const Function<Bool> > TrueCondition();
};
}
using namespace boost;
using namespace Wccl;
using namespace std;
#endif /* SWIG_LIBWCCL_TAGRULE_I */
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment