From a4f664069045ae5cdbe53d8d99c2dfac1c15c474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20K=C4=99dzia?= <pawel.kedzia@pwr.wroc.pl> Date: Mon, 4 Apr 2011 15:13:17 +0200 Subject: [PATCH] Added wrapper for Corpus2::Sentence --- swig/libcorpussentence.i | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 swig/libcorpussentence.i diff --git a/swig/libcorpussentence.i b/swig/libcorpussentence.i new file mode 100644 index 0000000..89f3c0a --- /dev/null +++ b/swig/libcorpussentence.i @@ -0,0 +1,46 @@ +#ifndef SWIG_LIBCORPUS2_SENTENCE_I +#define SWIG_LIBCORPUS2_SENTENCE_I + +%module libcorpussentence +%{ + #include <libcorpus2/sentence.h> +%} + +%include "libcorpustoken.i" + +%include "std_string.i" +%include "std_vector.i" + +%include "boost_shared_ptr.i" + +%feature("notabstract") Corpus2::Sentence; + +%rename(__op_get__) Corpus2::Sentence::operator[](size_t idx) const; + +namespace Corpus2 { + class Sentence { + public: + Sentence(); + virtual ~Sentence(); + + virtual boost::shared_ptr<Sentence> clone_shared() const; + + void release_tokens(); + bool empty() const; + size_t size() const; + Token* operator[](size_t idx); + const std::vector<Token*>& tokens() const; + std::vector<Token*>& tokens(); + virtual void append(Token* t); + const Token* first_token() const; + + }; +} + +%template(SentenceSharedPtr) boost::shared_ptr<Corpus2::Sentence>; + +using namespace boost; +using namespace std; +using namespace Corpus2; + +#endif /* SWIG_LIBCORPUS2_SENTENCE_I */ -- GitLab