diff --git a/swig/Makefile b/swig/Makefile index 04f2b15711d432c11760f14b25cbcc25c914aedc..3f7e76a16924443cee412765987d9990d2755ab6 100644 --- a/swig/Makefile +++ b/swig/Makefile @@ -19,6 +19,7 @@ CBIN=libcorpustag.o \ libcorpuslexeme.o \ libcorpussentence.o \ libcorpuschunk.o \ + libcorpustoken.o \ libcorpustokenwriter.o \ libcorpustokenreader.o \ libcorpusiob.o \ @@ -142,6 +143,13 @@ libcorpuschunk.o: $(CPP) -shared libcorpuschunk_wrap.o \ $(PWRUTILBIN) $(CORPUS2BIN) -o _libcorpuschunk.so +# Token +libcorpustoken.o: + $(SWIG) $(SWIGOPTS_LANG) libcorpustoken.i + $(CPP) -c libcorpustoken_wrap.cxx -I$(PYTHONDIR) $(CPPFLAGS) + $(CPP) -shared libcorpustoken_wrap.o \ + $(PWRUTILBIN) $(CORPUS2BIN) -o _libcorpustoken.so + # Sentence libcorpussentence.o: $(SWIG) $(SWIGOPTS_LANG) libcorpussentence.i diff --git a/swig/libcorpuschunk.i b/swig/libcorpuschunk.i index 1f5badba16a67e61a60c954cb3cf5f9f9afcf76e..baa3fc1e715e4a2aa2b401ce545ce300432bf1c9 100644 --- a/swig/libcorpuschunk.i +++ b/swig/libcorpuschunk.i @@ -16,6 +16,8 @@ %include "libcorpussentence.i" +%template(ChunkPtr) boost::shared_ptr<Corpus2::Chunk>; +%template(SentencePtrVector) std::vector<boost::shared_ptr<Sentence> >; %template(attr_map_t) std::map<std::string, std::string>; namespace Corpus2 { diff --git a/swig/libcorpussentence.i b/swig/libcorpussentence.i index 9fa1d1b2c231e8fdf88444f6c14c468a586661dc..d580b81377394a74bc94a4e777b27d3158fea296 100644 --- a/swig/libcorpussentence.i +++ b/swig/libcorpussentence.i @@ -12,6 +12,7 @@ %template(Ptr) boost::shared_ptr<Corpus2::Sentence>; %template(ConstPtr) boost::shared_ptr<const Corpus2::Sentence>; +%template(TokenPtrVector) std::vector<Corpus2::Token*>; namespace Corpus2 { class Sentence { diff --git a/swig/libcorpustagset.i b/swig/libcorpustagset.i index 4744f80e23f106c0353b835d37c76cd1943917f4..8030f6c23e5cd699dacb31b02dc1cd4a2fc5fb78 100644 --- a/swig/libcorpustagset.i +++ b/swig/libcorpustagset.i @@ -13,6 +13,9 @@ %feature("notabstract") Corpus2::Tagset; +%template(TagVector) std::vector<Corpus2::Tag>; +%template(StdStringVector) std::vector<std::string>; + namespace Corpus2 { class Tagset { public: diff --git a/swig/libcorpustagsetmanager.i b/swig/libcorpustagsetmanager.i index eea54cb1f7a6e588e4556a362e407932cb6d4e02..2e0ed4a82b6418c7d88a29c44f659df8c9a5040e 100644 --- a/swig/libcorpustagsetmanager.i +++ b/swig/libcorpustagsetmanager.i @@ -10,8 +10,10 @@ %include "std_string.i" %include "std_vector.i" +%include "boost_shared_ptr.i" %feature("notabstract") Corpus2::TagsetManager; +%template(TagsetPtr) boost::shared_ptr<Tagset>; namespace Corpus2 { class TagsetManager { @@ -21,8 +23,7 @@ namespace Corpus2 { /* --------------------------------------------------------------------- */ const Tagset& get_tagset(const std::string& name); - - // boost::shared_ptr<Tagset> get_cache_entry(const std::string& name); + boost::shared_ptr<Tagset> get_cache_entry(const std::string& name); /* --------------------------------------------------------------------- */ }; diff --git a/swig/libcorpustoken.i b/swig/libcorpustoken.i index 124b2ce85b6f6ee2375dbd9f919fbf4a87e849f7..079063b5d88d7c26eccbf75e83195f3f6833aff7 100644 --- a/swig/libcorpustoken.i +++ b/swig/libcorpustoken.i @@ -10,15 +10,15 @@ %include "libcorpuslexeme.i" %include "libcorpustagset.i" -%include "std_pair.i" %include "std_string.i" %include "std_vector.i" + %feature("notabstract") Corpus2::Token; -%rename(__op_eq__) Corpus2::Token::operator==(const Token& other) const; +%rename(__op_eq__) Corpus2::Token::operator==(const Corpus2::Token& other) const; -%template(lexemeVector) std::vector<Lexeme>; +%template(LexemeVector) std::vector<Corpus2::Lexeme>; namespace Corpus2 { class Token { diff --git a/swig/libcorpustokenreader.i b/swig/libcorpustokenreader.i index 1a6803611491f9303f9ce878fcb090b4283892a9..935ba2159fcdfd9c23e1303ab6cfe52c6db738a2 100644 --- a/swig/libcorpustokenreader.i +++ b/swig/libcorpustokenreader.i @@ -17,6 +17,8 @@ %nodefaultctor Corpus2::TokenReader; %template(TokenReaderPtr) boost::shared_ptr<Corpus2::TokenReader>; +// %template(StdStringVector) std::vector<std::string>; +// %template(ChunkPtr) boost::shared_ptr<Corpus2::Chunk>; namespace Corpus2 { class TokenReader {