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

(swig) Added wrapper for Wccl::TagRuleSequence

parent d68f1e0b
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,8 @@ CBIN=libcclvalue.o \ ...@@ -34,7 +34,8 @@ CBIN=libcclvalue.o \
libcclparser.o \ libcclparser.o \
libcclactionexeccontext.o \ libcclactionexeccontext.o \
libccltagaction.o \ libccltagaction.o \
libccltagrule.o libccltagrule.o \
libccltagrulesequence.o
CBINOUT=_libcclvalue.so \ CBINOUT=_libcclvalue.so \
_libcclstrset.so \ _libcclstrset.so \
...@@ -56,6 +57,7 @@ CBINOUT=_libcclvalue.so \ ...@@ -56,6 +57,7 @@ CBINOUT=_libcclvalue.so \
_libcclactionexeccontext.so \ _libcclactionexeccontext.so \
_libccltagaction.so \ _libccltagaction.so \
_libccltagrule.so \ _libccltagrule.so \
_libccltagrulesequence.so \
_boost_shared_ptr.so _boost_shared_ptr.so
CWRAP=libcclvalue_wrap.cxx \ CWRAP=libcclvalue_wrap.cxx \
...@@ -79,6 +81,7 @@ CWRAP=libcclvalue_wrap.cxx \ ...@@ -79,6 +81,7 @@ CWRAP=libcclvalue_wrap.cxx \
libcclactionexeccontext_wrap.cxx \ libcclactionexeccontext_wrap.cxx \
libccltagaction_wrap.cxx \ libccltagaction_wrap.cxx \
libccltagrule_wrap.cxx \ libccltagrule_wrap.cxx \
libccltagrulesequence_wrap.cxx \
boost_shared_ptr_wrap.cxx boost_shared_ptr_wrap.cxx
CWRAPBIN=libcclvalue_wrap.o \ CWRAPBIN=libcclvalue_wrap.o \
...@@ -101,6 +104,7 @@ CWRAPBIN=libcclvalue_wrap.o \ ...@@ -101,6 +104,7 @@ CWRAPBIN=libcclvalue_wrap.o \
libcclactionexeccontext_wrap.o \ libcclactionexeccontext_wrap.o \
libccltagaction_wrap.o \ libccltagaction_wrap.o \
libccltagrule_wrap.o \ libccltagrule_wrap.o \
libccltagrulesequence_wrap.o \
boost_shared_ptr_wrap.o boost_shared_ptr_wrap.o
PYMODULES=libcclvalue.py \ PYMODULES=libcclvalue.py \
...@@ -123,6 +127,7 @@ PYMODULES=libcclvalue.py \ ...@@ -123,6 +127,7 @@ PYMODULES=libcclvalue.py \
libcclactionexeccontext.py \ libcclactionexeccontext.py \
libccltagaction.py \ libccltagaction.py \
libccltagrule.py \ libccltagrule.py \
libccltagrulesequence.py \
boost_shared_ptr.py boost_shared_ptr.py
PYCBIN=libcclvalue.pyc \ PYCBIN=libcclvalue.pyc \
...@@ -145,6 +150,7 @@ PYCBIN=libcclvalue.pyc \ ...@@ -145,6 +150,7 @@ PYCBIN=libcclvalue.pyc \
libcclactionexeccontext.pyc \ libcclactionexeccontext.pyc \
libccltagaction.pyc \ libccltagaction.pyc \
libccltagrule.pyc \ libccltagrule.pyc \
libccltagrulesequence.pyc \
boost_shared_ptr.pyc boost_shared_ptr.pyc
all:boost_shared_ptr.o $(CBIN) all:boost_shared_ptr.o $(CBIN)
...@@ -310,6 +316,13 @@ libccltagrule.o: ...@@ -310,6 +316,13 @@ libccltagrule.o:
$(CPP) -shared libccltagrule_wrap.o \ $(CPP) -shared libccltagrule_wrap.o \
$(CCLBIN) $(ANTLRLIB) -o _libccltagrule.so $(CCLBIN) $(ANTLRLIB) -o _libccltagrule.so
# TagRuleSequence
libccltagrulesequence.o:
$(SWIG) $(SWIGOPTS_LANG) libccltagrulesequence.i
$(CPP) -c libccltagrulesequence_wrap.cxx -I$(PYTHONDIR) -I$(WCCLDIR) $(CPPFLAGS)
$(CPP) -shared libccltagrulesequence_wrap.o \
$(CCLBIN) $(ANTLRLIB) -o _libccltagrulesequence.so
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
clean: clean:
rm -f $(CBIN) $(CBINOUT) $(CWRAP) $(CWRAPBIN) $(PYMODULES) $(PYCBIN) rm -f $(CBIN) $(CBINOUT) $(CWRAP) $(CWRAPBIN) $(PYMODULES) $(PYCBIN)
#ifndef SWIG_LIBWCCL_TAGRULESEQUENCE_I
#define SWIG_LIBWCCL_TAGRULESEQUENCE_I
%module libccltagrulesequence
%{
#include <libwccl/ops/tagrulesequence.h>
%}
%include "libcclbool.i"
%include "libccltagrule.i"
%include "libcclexpression.i"
%include "libcorpus/libcorpussentence.i"
%include "std_string.i"
%include "std_vector.i"
%include "boost_shared_ptr.i"
%template(StdVectorTagRule) std::vector<TagRule>;
%template(TagRuleSequencPtr) boost::shared_ptr<Wccl::TagRuleSequence>;
namespace Wccl {
class TagRuleSequence : public std::vector<TagRule>, public Expression {
public:
TagRuleSequence(const std::vector<TagRule>& rules);
TagRuleSequence();
/* --------------------------------------------------------------------- */
%rename(OpFunTagRuleSequence) operator()(
const boost::shared_ptr<Corpus2::Sentence>& sentence
);
Bool operator()(const boost::shared_ptr<Corpus2::Sentence>& sentence);
/* --------------------------------------------------------------------- */
Bool execute_once(const boost::shared_ptr<Corpus2::Sentence>& sentence);
int execute_until_done(const boost::shared_ptr<Corpus2::Sentence>& sentence, int max_iter = 1000);
std::string to_string(const Corpus2::Tagset& tagset) const;
};
}
using namespace boost;
using namespace Wccl;
using namespace std;
#endif /* SWIG_LIBWCCL_TAGRULESEQUENCE_I */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment