diff --git a/swig/libcclbool.i b/swig/libcclbool.i new file mode 100644 index 0000000000000000000000000000000000000000..d19104da8d09502e82138bce0e62d6f70f36b522 --- /dev/null +++ b/swig/libcclbool.i @@ -0,0 +1,36 @@ +#ifndef SWIG_LIBWCCL_BOOL_I +#define SWIG_LIBWCCL_BOOL_I + +%module libcclbool +%{ + #include <libwccl/values/value.h> + #include <libwccl/values/bool.h> +%} + +%include "libcclvalue.i" +%include "std_string.i" + +%feature("notabstract") Wccl::Bool; + +namespace Wccl { + class Bool : public Value { + public: + const char* get_type_name() const { return type_name; } + static std::string var_repr(const std::string &var_name); + std::string make_var_repr(const std::string &var_name) const { + return var_repr(var_name); + } + + explicit Bool(bool v); + + const bool& get_value() const; + void set_value(bool v); + bool equals(const Bool& other) const; + std::string to_raw_string() const; + }; +} + +using namespace std; +using namespace Wccl; + +#endif /* SWIG_LIBWCCL_BOOL_I */ diff --git a/swig/libcclposition.i b/swig/libcclposition.i new file mode 100644 index 0000000000000000000000000000000000000000..b0ce83f1f82f4aa71310ef89a9b9d5a010f330b9 --- /dev/null +++ b/swig/libcclposition.i @@ -0,0 +1,46 @@ +#ifndef SWIG_LIBWCCL_POSITION_I +#define SWIG_LIBWCCL_POSITION_I + +%module libcclposition +%{ + #include <libwccl/values/value.h> + #include <libwccl/values/position.h> + #include <boost/integer_traits.hpp> +%} + +%include "libcclvalue.i" +%include "std_string.i" + +%feature("notabstract") Wccl::Position; + +namespace Wccl { + class Position : public Value { + public: + const char* get_type_name() const { return type_name; } + static std::string var_repr(const std::string &var_name); + std::string make_var_repr(const std::string &var_name) const { + return var_repr(var_name); + } + + typedef int value_type; + + enum Enum { + Nowhere = boost::integer_traits<int>::const_min, + Begin = boost::integer_traits<int>::const_min + 1, + End = boost::integer_traits<int>::const_max + }; + + explicit Position(int v = Nowhere); + const int& get_value() const; + void set_value(int v); + std::string to_raw_string() const; + bool equals(const Position& other) const; + + // bool equals(const Position& other, const SentenceContext& context) const; + }; +} + +using namespace std; +using namespace Wccl; + +#endif /* SWIG_LIBWCCL_POSITION_I */ diff --git a/swig/libcclstrset.i b/swig/libcclstrset.i new file mode 100644 index 0000000000000000000000000000000000000000..fc2f444a12422a5f1e4b7d29df9feb8817625571 --- /dev/null +++ b/swig/libcclstrset.i @@ -0,0 +1,56 @@ +#ifndef SWIG_LIBWCCL_STRSET_I +#define SWIG_LIBWCCL_STRSET_I + +%module libcclstrset +%{ + #include <libwccl/values/value.h> + #include <libwccl/values/strset.h> + #include <boost/unordered_set.hpp> + #include <libcorpus2/lexeme.h> +%} + +%include "libcclvalue.i" +%include "std_string.i" + +%feature("notabstract") Wccl::StrSet; + +namespace Wccl { + class StrSet : public Value { + public: + const char* get_type_name() const { return type_name; } + static std::string var_repr(const std::string &var_name); + std::string make_var_repr(const std::string &var_name) const { + return var_repr(var_name); + } + + typedef boost::unordered_set<UnicodeString> value_type; + + StrSet(); + explicit StrSet(const value_type& s); + + const value_type& get_value() const; + void set_value(const value_type& set); + const value_type& contents() const; + value_type& contents(); + void swap(StrSet& ss); + + // TEST IT! + void insert(const UnicodeString& u); + void insert_utf8(const std::string& u); + + int size() const; + bool empty() const; + bool is_subset_of(const StrSet& other) const; + bool intersects(const StrSet& other) const; + bool equals(const StrSet& other) const; + std::string to_raw_string() const; + + // + UnicodeString to_raw_string_u() const; + }; +} + +using namespace std; +using namespace Wccl; + +#endif /* SWIG_LIBWCCL_STRSET_I */ diff --git a/swig/libccltset.i b/swig/libccltset.i new file mode 100644 index 0000000000000000000000000000000000000000..cd8eb1b3db31e0c2c8886562d5dd4d37a2bf1cc1 --- /dev/null +++ b/swig/libccltset.i @@ -0,0 +1,55 @@ +#ifndef SWIG_LIBWCCL_TSET_I +#define SWIG_LIBWCCL_TSET_I + +%module libccltset +%{ + #include <libwccl/values/value.h> + #include <libwccl/values/tset.h> +%} + +/* Include required headers */ +%include "libcorpustag.i" + +%include "libcclvalue.i" +%include "std_string.i" + +%feature("notabstract") Wccl::TSet; + +namespace Wccl { + class TSet : public Value { + public: + const char* get_type_name() const { return type_name; } + static std::string var_repr(const std::string &var_name); + std::string make_var_repr(const std::string &var_name) const { + return var_repr(var_name); + } + + TSet(); + explicit TSet(Corpus2::Tag tag); + + const Corpus2::Tag& get_value() const; + void set_value(const Corpus2::Tag& tag); + const Corpus2::Tag& contents(); + + void insert_symbol(const Corpus2::Tagset& tagset, const std::string& s); + + bool empty() const; + bool is_subset_of(const TSet& other) const; + bool intersects(const TSet& other) const; + bool equals(const TSet& other) const; + + int categories_count(const Corpus2::Tagset& tagset) const; + int matching_categories(const Corpus2::Tag& tag) const; + + void combine_with(const Corpus2::Tag& other); + void combine_with(const TSet& other); + + std::string to_string(const Corpus2::Tagset &) const; + std::string to_raw_string() const; + }; +} + +using namespace std; +using namespace Wccl; + +#endif /* SWIG_LIBWCCL_TSET_I */ diff --git a/swig/libcclvalue.i b/swig/libcclvalue.i new file mode 100644 index 0000000000000000000000000000000000000000..5ee3a9c2890f12797e4b24bd234ff52e7d2a57fa --- /dev/null +++ b/swig/libcclvalue.i @@ -0,0 +1,28 @@ +#ifndef SWIG_LIBWCCL_VALUE_I +#define SWIG_LIBWCCL_VALUE_I + +%module libcclvalue +%{ + #include <libwccl/values/value.h> +%} + +%include "std_string.i" + +namespace Wccl { + class Value { + public: + static const char* type_name; + + virtual const char* get_type_name() const; + virtual ~Value(); + + virtual std::string make_var_repr(const std::string&) const = 0; + virtual std::string to_string(const Corpus2::Tagset& /*tagset*/) const; + virtual std::string to_raw_string() const = 0; + }; +} + +using namespace std; +using namespace Wccl; + +#endif /* SWIG_LIBWCCL_VALUE_I */