From 96a030ff68e91a32a63041e84a873eae20465418 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20K=C4=99dzia?= <Pawel.Kedzia@pwr.wroc.pl>
Date: Thu, 28 Apr 2011 09:45:40 +0200
Subject: [PATCH] Some fixes

---
 swig/Makefile                 | 8 ++++++++
 swig/libcorpuschunk.i         | 2 ++
 swig/libcorpussentence.i      | 1 +
 swig/libcorpustagset.i        | 3 +++
 swig/libcorpustagsetmanager.i | 5 +++--
 swig/libcorpustoken.i         | 6 +++---
 swig/libcorpustokenreader.i   | 2 ++
 7 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/swig/Makefile b/swig/Makefile
index 04f2b15..3f7e76a 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 1f5badb..baa3fc1 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 9fa1d1b..d580b81 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 4744f80..8030f6c 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 eea54cb..2e0ed4a 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 124b2ce..079063b 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 1a68036..935ba21 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 {
-- 
GitLab