From 108399ead7aa0399ac83f18a0e42efa419fc7b55 Mon Sep 17 00:00:00 2001
From: Adam Radziszewski <adam.radziszewski@pwr.wroc.pl>
Date: Wed, 21 Dec 2011 13:38:43 +0100
Subject: [PATCH] fix SWIG != operator, advance ver

---
 CMakeLists.txt | 2 +-
 swig/lexeme.i  | 5 +++++
 swig/tag.i     | 7 ++++++-
 swig/token.i   | 8 ++++++++
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 75b518f..2a93df4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ PROJECT(Corpus2Library)
 
 set(corpus2_ver_major "1")
 set(corpus2_ver_minor "0")
-set(corpus2_ver_patch "15")
+set(corpus2_ver_patch "16")
 
 cmake_minimum_required(VERSION 2.8.0)
 
diff --git a/swig/lexeme.i b/swig/lexeme.i
index 8e3b256..e5a8a62 100644
--- a/swig/lexeme.i
+++ b/swig/lexeme.i
@@ -48,6 +48,11 @@ namespace Corpus2 {
     Corpus2::Tag tag() {
       return Corpus2::Tag(self->tag().get_pos(), self->tag().get_values());
     }
+    // otherwise x != y wont trigger operator==
+    %pythoncode %{
+      def __ne__(self, other):
+        return not self.__eq__(other)
+    %}
   }
 }
 
diff --git a/swig/tag.i b/swig/tag.i
index 9c8f58a..80d5d51 100644
--- a/swig/tag.i
+++ b/swig/tag.i
@@ -49,10 +49,15 @@ namespace Corpus2 {
 
   size_t hash_value(const Tag &tag);
 
-  %extend Tag {
+  %extend Tag {  
     long __hash__() {
       return (long) hash_value(*self);
     }
+    // otherwise x != y wont trigger operator==
+    %pythoncode %{
+      def __ne__(self, other):
+        return not self.__eq__(other)
+    %}
   }
 
 }
diff --git a/swig/token.i b/swig/token.i
index 9cea646..0290fd4 100644
--- a/swig/token.i
+++ b/swig/token.i
@@ -68,6 +68,14 @@ namespace Corpus2 {
     void set_metadata(TokenMetaData& md);
     void set_metadata_ptr(boost::shared_ptr<TokenMetaData> md);
   };
+
+  %extend Token {
+    // otherwise x != y wont trigger operator==
+    %pythoncode %{
+      def __ne__(self, other):
+        return not self.__eq__(other)
+    %}
+  }
 }
 
 using namespace std;
-- 
GitLab