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
Branches
No related merge requests found
...@@ -23,7 +23,8 @@ CBIN=libcorpustag.o \ ...@@ -23,7 +23,8 @@ CBIN=libcorpustag.o \
libcorpustokenwriter.o \ libcorpustokenwriter.o \
libcorpustokenreader.o \ libcorpustokenreader.o \
libcorpusiob.o \ libcorpusiob.o \
libcorpusannotationchannel.o libcorpusannotationchannel.o \
libcorpusannotatedsentence.o
CBINOUT=_boost_shared_ptr.so \ CBINOUT=_boost_shared_ptr.so \
_libcorpustag.so \ _libcorpustag.so \
...@@ -36,7 +37,8 @@ CBINOUT=_boost_shared_ptr.so \ ...@@ -36,7 +37,8 @@ CBINOUT=_boost_shared_ptr.so \
_libcorpustokenwriter.so \ _libcorpustokenwriter.so \
_libcorpustokenreader.so \ _libcorpustokenreader.so \
_libcorpusiob.so \ _libcorpusiob.so \
_libcorpusannotationchannel.so _libcorpusannotationchannel.so \
_libcorpusannotatedsentence.so
CWRAP=boost_shared_ptr_wrap.cxx \ CWRAP=boost_shared_ptr_wrap.cxx \
libcorpustag_wrap.cxx \ libcorpustag_wrap.cxx \
...@@ -49,7 +51,8 @@ CWRAP=boost_shared_ptr_wrap.cxx \ ...@@ -49,7 +51,8 @@ CWRAP=boost_shared_ptr_wrap.cxx \
libcorpustokenwriter_wrap.cxx \ libcorpustokenwriter_wrap.cxx \
libcorpustokenreader_wrap.cxx \ libcorpustokenreader_wrap.cxx \
libcorpusiob_wrap.cxx \ libcorpusiob_wrap.cxx \
libcorpusannotationchannel_wrap.cxx libcorpusannotationchannel_wrap.cxx \
libcorpusannotatedsentence_wrap.cxx
CWRAPBIN=boost_shared_ptr_wrap.o \ CWRAPBIN=boost_shared_ptr_wrap.o \
libcorpustag_wrap.o \ libcorpustag_wrap.o \
...@@ -62,7 +65,8 @@ CWRAPBIN=boost_shared_ptr_wrap.o \ ...@@ -62,7 +65,8 @@ CWRAPBIN=boost_shared_ptr_wrap.o \
libcorpustokenwriter_wrap.o \ libcorpustokenwriter_wrap.o \
libcorpustokenreader_wrap.o \ libcorpustokenreader_wrap.o \
libcorpusiob_wrap.o \ libcorpusiob_wrap.o \
libcorpusannotationchannel_wrap.o libcorpusannotationchannel_wrap.o \
libcorpusannotatedsentence_wrap.o
PYMODULES=boost_shared_ptr.py \ PYMODULES=boost_shared_ptr.py \
libcorpustag.py \ libcorpustag.py \
...@@ -75,7 +79,8 @@ PYMODULES=boost_shared_ptr.py \ ...@@ -75,7 +79,8 @@ PYMODULES=boost_shared_ptr.py \
libcorpustokenwriter.py \ libcorpustokenwriter.py \
libcorpustokenreader.py \ libcorpustokenreader.py \
libcorpusiob.py \ libcorpusiob.py \
libcorpusannotationchannel.py libcorpusannotationchannel.py \
libcorpusannotatedsentence.py
PYCBIN=boost_shared_ptr.pyc \ PYCBIN=boost_shared_ptr.pyc \
libcorpustag.pyc \ libcorpustag.pyc \
...@@ -88,7 +93,8 @@ PYCBIN=boost_shared_ptr.pyc \ ...@@ -88,7 +93,8 @@ PYCBIN=boost_shared_ptr.pyc \
libcorpustokenwriter.pyc \ libcorpustokenwriter.pyc \
libcorpustokenreader.pyc \ libcorpustokenreader.pyc \
libcorpusiob.pyc \ libcorpusiob.pyc \
libcorpusannotationchannel.pyc libcorpusannotationchannel.pyc \
libcorpusannotatedsentence.pyc
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
all:boost_shared_ptr.o $(CBIN) all:boost_shared_ptr.o $(CBIN)
...@@ -185,6 +191,13 @@ libcorpusannotationchannel.o: ...@@ -185,6 +191,13 @@ libcorpusannotationchannel.o:
$(CPP) -shared libcorpusannotationchannel_wrap.o \ $(CPP) -shared libcorpusannotationchannel_wrap.o \
$(PWRUTILBIN) $(CORPUS2BIN) -o _libcorpusannotationchannel.so $(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: clean:
rm -f $(CBIN) $(CBINOUT) $(CWRAP) $(CWRAPBIN) $(PYMODULES) $(PYCBIN) 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% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment