diff --git a/CMakeLists.txt b/CMakeLists.txt index 75b518f36d8246f22605589dc72815591d4cfb8e..2a93df4993bc0d91a3566a832a8acf849dc73139 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 8e3b2566cf00cb059cfc825436c1b50bd48752fc..e5a8a6286f0a8533cb523a76237a525460f33619 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 9c8f58a79780438e988b54ba706ed4347bf6890d..80d5d515b66e2180ff229bfd8c2703fffb06046b 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 9cea646b11617476fcb6afd7fa850f62d0bceead..0290fd404b1c0c5f27b49bb350ae0930a9f62b1c 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;