Skip to content
Snippets Groups Projects
Commit 7c4e9eef authored by Paweł Kędzia's avatar Paweł Kędzia
Browse files

Added wrappers for ccl values

parent 21fb0bac
No related branches found
No related tags found
No related merge requests found
#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 */
#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 */
#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 */
#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 */
#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 */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment