diff --git a/swig/Makefile b/swig/Makefile index 6f53c276dda88de3ab4112d03e2dd4ecf3f7e584..deca8df97d7bd255ef2081703854dfae3a9d9e5b 100644 --- a/swig/Makefile +++ b/swig/Makefile @@ -21,6 +21,7 @@ CBIN=libcclvalue.o \ libccltset.o \ libcclstrset.o \ libcclmatch.o \ + libcclmatchdata.o \ libcclexpression.o \ libcclparsedexpression.o \ libcclfunctionaloperator.o \ @@ -39,6 +40,7 @@ CBINOUT=_libcclvalue.so \ _libcclfunctionaloperator.so \ _libcclvariables.so \ _libcclmatch.so \ + _libcclmatchdata.so \ _libcclsentencecontext.so \ _libccloperator.so \ _libcclparser.so \ @@ -55,6 +57,7 @@ CWRAP=libcclvalue_wrap.cxx \ libcclfunctionaloperator_wrap.cxx \ libcclvariables_wrap.cxx \ libcclmatch_wrap.cxx \ + libcclmatchdata_wrap.cxx \ libcclsentencecontext_wrap.cxx \ libcorpussentence_wrap.cxx \ libccloperator_wrap.cxx \ @@ -70,6 +73,7 @@ CWRAPBIN=libcclvalue_wrap.o \ libcclfunctionaloperator_wrap.o \ libcclvariables_wrap.o \ libcclmatch_wrap.o \ + libcclmatchdata_wrap.o \ libcclsentencecontext_wrap.o \ libccloperator_wrap.o \ libcclparser_wrap.o \ @@ -81,6 +85,8 @@ PYMODULES=libcclvalue.py \ libcclparser.py \ libcclposition.py \ libccltset.py \ + libcclmatch.py \ + libcclmatchdata.py \ libcclexpression.py \ libcclparsedexpression.py \ libcclvariables.py \ @@ -94,6 +100,8 @@ PYCBIN=libcclvalue.pyc \ libcclbool.pyc \ libcclposition.pyc \ libccltset.pyc \ + libcclmatch.pyc \ + libcclmatchdata.pyc \ libcclexpression.pyc \ libcclparsedexpression.pyc \ libcclvariables.pyc \ @@ -164,6 +172,13 @@ libcclmatch.o: $(CPP) -shared libcclmatch_wrap.o \ $(CCLBIN) $(ANTLRLIB) -o _libcclmatch.so +# matchdata +libcclmatchdata.o: + $(SWIG) $(SWIGOPTS_LANG) libcclmatchdata.i + $(CPP) -c libcclmatchdata_wrap.cxx -I$(PYTHONDIR) -I$(WCCLDIR) $(CPPFLAGS) + $(CPP) -shared libcclmatchdata_wrap.o \ + $(CCLBIN) $(ANTLRLIB) -o _libcclmatchdata.so + # Expression libcclexpression.o: $(SWIG) $(SWIGOPTS_LANG) libcclexpression.i diff --git a/swig/libcclmatchdata.i b/swig/libcclmatchdata.i new file mode 100644 index 0000000000000000000000000000000000000000..f8adb7dec2f62957c6e54b98697c0c1d755f7522 --- /dev/null +++ b/swig/libcclmatchdata.i @@ -0,0 +1,44 @@ +#ifndef SWIG_LIBWCCL_MATCHDATA_I +#define SWIG_LIBWCCL_MATCHDATA_I + +%module libcclmatchdata +%{ + #include <libwccl/values/matchdata.h> +%} + +%include "boost_shared_ptr.i" +%include "libcclmatch.i" +%include "libcorpus/libcorpusannotatedsentence.i" + +%template(MatchDataPtr) boost::shared_ptr<Wccl::MatchData>; + +namespace Wccl { + class MatchData { + public: + ~MatchData(); + + /* --------------------------------------------------------------------- */ + + virtual bool empty() const = 0; + virtual Position first_token(const boost::shared_ptr<Corpus2::AnnotatedSentence>&) const = 0; + virtual Position last_token(const boost::shared_ptr<Corpus2::AnnotatedSentence>&) const = 0; + + /* --------------------------------------------------------------------- */ + + virtual const boost::shared_ptr<Match>& submatch(size_t); + + /* --------------------------------------------------------------------- */ + + boost::shared_ptr<MatchData> clone() const; + + /* --------------------------------------------------------------------- */ + + virtual std::string to_raw_string() const = 0; + }; +} + +using namespace std; +using namespace Wccl; +using namespace boost; + +#endif /* SWIG_LIBWCCL_MATCHDATA_I */