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

Corpus2::Chunk wrapper

parent 485a1a43
Branches
No related merge requests found
......@@ -17,7 +17,8 @@ CBIN=libcorpustag.o \
libcorpustagset.o \
libcorpustagsetmanager.o \
libcorpuslexeme.o \
libcorpussentence.o
libcorpussentence.o \
libcorpuschunk.o
CBINOUT=_boost_shared_ptr.so \
_libcorpustag.so \
......@@ -25,7 +26,8 @@ CBINOUT=_boost_shared_ptr.so \
_libcorpustagsetmanager.so \
_libcorpuslexeme.so \
_libcorpustoken.so \
_libcorpussentence.so
_libcorpussentence.so \
_libcorpuschunk.so
CWRAP=boost_shared_ptr_wrap.cxx \
libcorpustag_wrap.cxx \
......@@ -33,7 +35,8 @@ CWRAP=boost_shared_ptr_wrap.cxx \
libcorpustagsetmanager_wrap.cxx \
libcorpuslexeme_wrap.cxx \
libcorpustoken_wrap.cxx \
libcorpussentence_wrap.cxx
libcorpussentence_wrap.cxx \
libcorpuschunk_wrap.cxx
CWRAPBIN=boost_shared_ptr_wrap.o \
libcorpustag_wrap.o \
......@@ -41,7 +44,8 @@ CWRAPBIN=boost_shared_ptr_wrap.o \
libcorpustagsetmanager_wrap.o \
libcorpuslexeme_wrap.o \
libcorpustoken_wrap.o \
libcorpussentence_wrap.o
libcorpussentence_wrap.o \
libcorpuschunk_wrap.o
PYMODULES=boost_shared_ptr.py \
libcorpustag.py \
......@@ -49,7 +53,8 @@ PYMODULES=boost_shared_ptr.py \
libcorpustagsetmanager.py \
libcorpuslexeme.py \
libcorpustoken.py \
libcorpussentence.py
libcorpussentence.py \
libcorpuschunk.py
PYCBIN=boost_shared_ptr.pyc \
libcorpustag.pyc \
......@@ -57,7 +62,8 @@ PYCBIN=boost_shared_ptr.pyc \
libcorpustagsetmanager.pyc \
libcorpuslexeme.pyc \
libcorpustoken.pyc \
libcorpussentence.pyc
libcorpussentence.pyc \
libcorpuschunk.pyc
# -----------------------------------------------------------------------------
all:boost_shared_ptr.o $(CBIN)
......@@ -105,6 +111,13 @@ libcorpuslexeme.o:
$(CPP) -shared libcorpuslexeme_wrap.o \
$(PWRUTILBIN) $(CORPUS2BIN) -o _libcorpuslexeme.so
# Chunk
libcorpuschunk.o:
$(SWIG) $(SWIGOPTS_LANG) libcorpuschunk.i
$(CPP) -c libcorpuschunk_wrap.cxx -I$(PYTHONDIR) $(CPPFLAGS)
$(CPP) -shared libcorpuschunk_wrap.o \
$(PWRUTILBIN) $(CORPUS2BIN) -o _libcorpuschunk.so
# Sentence
libcorpussentence.o:
$(SWIG) $(SWIGOPTS_LANG) libcorpussentence.i
......
#ifndef SWIG_LIBCORPUS2_CHUNK_I
#define SWIG_LIBCORPUS2_CHUNK_I
%module libcorpuschunk
%{
#include <libcorpus2/chunk.h>
%}
%include "std_set.i"
%include "std_map.i"
%include "std_pair.i"
%include "std_string.i"
%include "std_vector.i"
%include "boost_shared_ptr.i"
%include "libcorpussentence.i"
%template(attr_map_t) std::map<std::string, std::string>;
namespace Corpus2 {
class Chunk {
public:
Chunk();
~Chunk();
/* --------------------------------------------------------------------- */
boost::shared_ptr<Chunk> clone_shared() const;
bool empty() const;
size_t size() const;
bool has_attribute(const std::string& name) const;
std::string get_attribute(const std::string& name) const;
void set_attribute(const std::string& name, const std::string& value);
std::vector< boost::shared_ptr<Sentence> >& sentences();
const std::vector< boost::shared_ptr<Sentence> >& sentences() const;
void append(const boost::shared_ptr<Sentence>& s);
typedef std::map<std::string, std::string> attr_map_t;
const attr_map_t& attributes() const;
};
}
using namespace std;
using namespace Corpus2;
#endif /* SWIG_LIBCORPUS2_CHUNK_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