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

Wrapper for Corpus2::AnnotatedSentence

parent 96a030ff
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,8 @@ CBIN=libcorpustag.o \
libcorpustokenwriter.o \
libcorpustokenreader.o \
libcorpusiob.o \
libcorpusannotationchannel.o
libcorpusannotationchannel.o \
libcorpusannotatedsentence.o
CBINOUT=_boost_shared_ptr.so \
_libcorpustag.so \
......@@ -36,7 +37,8 @@ CBINOUT=_boost_shared_ptr.so \
_libcorpustokenwriter.so \
_libcorpustokenreader.so \
_libcorpusiob.so \
_libcorpusannotationchannel.so
_libcorpusannotationchannel.so \
_libcorpusannotatedsentence.so
CWRAP=boost_shared_ptr_wrap.cxx \
libcorpustag_wrap.cxx \
......@@ -49,7 +51,8 @@ CWRAP=boost_shared_ptr_wrap.cxx \
libcorpustokenwriter_wrap.cxx \
libcorpustokenreader_wrap.cxx \
libcorpusiob_wrap.cxx \
libcorpusannotationchannel_wrap.cxx
libcorpusannotationchannel_wrap.cxx \
libcorpusannotatedsentence_wrap.cxx
CWRAPBIN=boost_shared_ptr_wrap.o \
libcorpustag_wrap.o \
......@@ -62,7 +65,8 @@ CWRAPBIN=boost_shared_ptr_wrap.o \
libcorpustokenwriter_wrap.o \
libcorpustokenreader_wrap.o \
libcorpusiob_wrap.o \
libcorpusannotationchannel_wrap.o
libcorpusannotationchannel_wrap.o \
libcorpusannotatedsentence_wrap.o
PYMODULES=boost_shared_ptr.py \
libcorpustag.py \
......@@ -75,7 +79,8 @@ PYMODULES=boost_shared_ptr.py \
libcorpustokenwriter.py \
libcorpustokenreader.py \
libcorpusiob.py \
libcorpusannotationchannel.py
libcorpusannotationchannel.py \
libcorpusannotatedsentence.py
PYCBIN=boost_shared_ptr.pyc \
libcorpustag.pyc \
......@@ -88,7 +93,8 @@ PYCBIN=boost_shared_ptr.pyc \
libcorpustokenwriter.pyc \
libcorpustokenreader.pyc \
libcorpusiob.pyc \
libcorpusannotationchannel.pyc
libcorpusannotationchannel.pyc \
libcorpusannotatedsentence.pyc
# -----------------------------------------------------------------------------
all:boost_shared_ptr.o $(CBIN)
......@@ -185,6 +191,13 @@ libcorpusannotationchannel.o:
$(CPP) -shared libcorpusannotationchannel_wrap.o \
$(PWRUTILBIN) $(CORPUS2BIN) -o _libcorpusannotationchannel.so
# AnotatedSentence
libcorpusannotatedsentence.o:
$(SWIG) $(SWIGOPTS_LANG) libcorpusannotatedsentence.i
$(CPP) -c libcorpusannotatedsentence_wrap.cxx -I$(PYTHONDIR) $(CPPFLAGS)
$(CPP) -shared libcorpusannotatedsentence_wrap.o \
$(PWRUTILBIN) $(CORPUS2BIN) -o _libcorpusannotatedsentence.so
# -----------------------------------------------------------------------------
clean:
rm -f $(CBIN) $(CBINOUT) $(CWRAP) $(CWRAPBIN) $(PYMODULES) $(PYCBIN)
#ifndef SWIG_LIBCORPUS2_ANNOTATEDSENTENCE_I
#define SWIG_LIBCORPUS2_ANNOTATEDSENTENCE_I
%module libcorpusannotatedsentence
%{
#include <libcorpus2/ann/annotatedsentence.h>
%}
%include "libcorpustoken.i"
%include "libcorpussentence.i"
%include "libcorpusannotationchannel.i"
%include "boost_shared_ptr.i"
%include "std_map.i"
%include "std_string.i"
%feature("notabstract") Corpus2::AnnotatedSentence;
%template(chan_map_t) std::map<std::string, Corpus2::AnnotationChannel>;
%template(SentencePtr) boost::shared_ptr<Corpus2::Sentence>;
%template(AnnotatedSentencePtr) boost::shared_ptr<Corpus2::AnnotatedSentence>;
namespace Corpus2 {
class AnnotatedSentence : public Corpus2::Sentence {
public:
typedef std::map<std::string, AnnotationChannel> chan_map_t;
/* --------------------------------------------------------------------- */
AnnotatedSentence();
~AnnotatedSentence();
/* --------------------------------------------------------------------- */
Sentence::Ptr clone_shared() const;
static boost::shared_ptr<AnnotatedSentence> wrap_sentence(
const boost::shared_ptr<Sentence>& s);
static boost::shared_ptr<AnnotatedSentence> wrap_sentence_clone(
const boost::shared_ptr<Sentence>& s);
/* --------------------------------------------------------------------- */
void create_channel(const std::string& name);
bool has_channel(const std::string& name) const;
AnnotationChannel& get_channel(const std::string& name);
const AnnotationChannel& get_channel(const std::string& name) const;
const chan_map_t& all_channels() const;
/* --------------------------------------------------------------------- */
void append(Token *t);
/* --------------------------------------------------------------------- */
std::string annotation_info() const;
};
}
using namespace std;
using namespace Corpus2;
#endif /* SWIG_LIBCORPUS2_ANNOTATEDSENTENCE_I */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment