diff --git a/swig/boost_shared_ptr.i b/swig/boost_shared_ptr.i new file mode 100644 index 0000000000000000000000000000000000000000..1db8cbec5a26b3ca7b3709277971d8bc1ef6c9ad --- /dev/null +++ b/swig/boost_shared_ptr.i @@ -0,0 +1,23 @@ +/** + * Wrapper for boost shared_ptr + */ +#ifndef SWIG_BOOST_SHAREDPTR +#define SWIG_BOOST_SHAREDPTR + +%module swig_boost_shared_ptr +%{ +%} + +namespace boost { + template<class T> class shared_ptr { + public: + shared_ptr(); + shared_ptr(T * p); + T* operator->(); + private: + T * px; + int pn; + }; +} + +#endif /* SWIG_BOOST_SHAREDPTR */ diff --git a/swig/libcclparser.i b/swig/libcclparser.i new file mode 100644 index 0000000000000000000000000000000000000000..2b830cc92caa26ffa761542e2a7b094e17f08a35 --- /dev/null +++ b/swig/libcclparser.i @@ -0,0 +1,29 @@ +#ifndef SWIG_LIBCCL_PARSER_I +#define SWIG_LIBCCL_PARSER_I + +%module libcclparser +%{ + #include <libwccl/parser/Parser.h> +%} + +%include "libcorpustagsetmanager.i" + +%include "std_string.i" +%include "std_vector.i" + +namespace Wccl { + class Parser { + public: + Parser(const Corpus2::Tagset&); + ~TagsetManager(); + + /* --------------------------------------------------------------------- */ + }; + + inline const Tagset& get_named_tagset(const std::string& name); +} + +using namespace std; +using namespace Corpus2; + +#endif /* SWIG_LIBCCL_PARSER_I */ diff --git a/swig/libcorpustag.i b/swig/libcorpustag.i new file mode 100644 index 0000000000000000000000000000000000000000..4184bca38e9e286c4902a10f2223816866a2acc4 --- /dev/null +++ b/swig/libcorpustag.i @@ -0,0 +1,55 @@ +#ifndef SWIG_LIBCORPUS2_TAG_I +#define SWIG_LIBCORPUS2_TAG_I + +%module libcorpustag +%{ + #include <libcorpus2/tag.h> + #include <boost/cstdint.hpp> +%} + +%include "std_string.i" +%include "std_vector.i" + +/* Typedefs */ +%inline %{ + typedef std::bitset<64> mask_t; +%} + +%feature("notabstract") Corpus2::Tag; + +namespace Corpus2 { + class Tag { + public: + Tag(); + explicit Tag(mask_t pos); + Tag(mask_t pos, mask_t values); + + /* --------------------------------------------------------------------- */ + ~Tag(); + + /* --------------------------------------------------------------------- */ + bool is_null() const; + int pos_count() const; + int get_pos_index() const; + + mask_t get_values() const; + mask_t get_pos() const; + + Tag& combine_with(const Tag& other); + Tag get_combined(const Tag& other) const; + Tag& mask_with(const Tag& other); + Tag get_masked(const Tag& other); + + std::string raw_dump() const; + bool operator<(const Tag& other) const; + bool operator==(const Tag& other) const; + }; + + size_t hash_value(const Tag &tag); +} + +using namespace std; +using namespace Corpus2; + + +#endif /* SWIG_LIBCORPUS2_TAG_I */ diff --git a/swig/libcorpustagset.i b/swig/libcorpustagset.i new file mode 100644 index 0000000000000000000000000000000000000000..1e581d7922f15e720d899a8b899bbdd3243dd297 --- /dev/null +++ b/swig/libcorpustagset.i @@ -0,0 +1,69 @@ +#ifndef SWIG_LIBCORPUS2_TAGSET_I +#define SWIG_LIBCORPUS2_TAGSET_I + +%module libcorpustagset +%{ + #include <libcorpus2/tagset.h> +%} + +%include "libcorpustag.i" + +%include "std_string.i" +%include "std_vector.i" + +%feature("notabstract") Corpus2::Tagset; + +namespace Corpus2 { + class Tagset { + public: + Tagset(); + static Tagset from_data(const char*); + + /* --------------------------------------------------------------------- */ + Tag parse_symbol(const std::string& s) const; + + /* --------------------------------------------------------------------- */ + std::vector<Tag> parse_tag(const char* c, bool allow_extra) const; + Tag parse_simple_tag(const char* c, bool allow_extra) const; + Tag make_ign_tag() const; + + /* --------------------------------------------------------------------- */ + std::string tag_to_string(const Tag& tag) const; + std::string tag_to_no_opt_string(const Tag &tag) const; + + /* --------------------------------------------------------------------- */ + std::vector<std::string> tag_to_symbol_string_vector(const Tag& tag, bool + compress_attribites = true) const; + + std::string tag_to_symbol_string(const Tag& tag, + bool compress_attribites = true) const; + + /* --------------------------------------------------------------------- */ + size_t tag_size(const Tag& tag) const; + bool tag_is_singular(const Tag& tag) const; + + /* --------------------------------------------------------------------- */ + std::vector<Tag> split_tag(const Tag& tag) const; + + /* --------------------------------------------------------------------- */ + int pos_count() const; + int attribute_count() const; + int value_count() const; + size_t size() const; + + double size_extra() const; + + /* --------------------------------------------------------------------- */ + std::string name() const; + void set_name(const std::string& name); + + + std::string id_string() const; + std::string id_string(const Tag& tag) const; + }; +} + +using namespace std; +using namespace Corpus2; + +#endif /* SWIG_LIBCORPUS2_TAGSET_I */ diff --git a/swig/libcorpustagsetmanager.i b/swig/libcorpustagsetmanager.i new file mode 100644 index 0000000000000000000000000000000000000000..07dcbbe170cc9ae4ca9d628ad4fd4e3aa3468d1f --- /dev/null +++ b/swig/libcorpustagsetmanager.i @@ -0,0 +1,31 @@ +#ifndef SWIG_LIBCORPUS2_TAGSETMANAGER_I +#define SWIG_LIBCORPUS2_TAGSETMANAGER_I + +%module libcorpustagsetmanager +%{ + #include <libcorpus2/tagsetmanager.h> +%} + +%include "libcorpustagset.i" + +%include "std_string.i" +%include "std_vector.i" + +%feature("notabstract") Corpus2::TagsetManager; + +namespace Corpus2 { + class TagsetManager { + public: + TagsetManager(); + ~TagsetManager(); + + /* --------------------------------------------------------------------- */ + }; + + inline const Tagset& get_named_tagset(const std::string& name); +} + +using namespace std; +using namespace Corpus2; + +#endif /* SWIG_LIBCORPUS2_TAGSETMANAGER_I */