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

(swig) Added wrapper for Wccl::Lexicon

parent ee9c4662
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,7 @@ CBIN=libcclvalue.o \ ...@@ -39,6 +39,7 @@ CBIN=libcclvalue.o \
libcclmatchrule.o \ libcclmatchrule.o \
libcclmatchrulesequence.o \ libcclmatchrulesequence.o \
libcclfunctionalopsequence.o \ libcclfunctionalopsequence.o \
libccllexicon.o \
libcclwcclfileopsections.o \ libcclwcclfileopsections.o \
libcclwcclfile.o \ libcclwcclfile.o \
wccl.o wccl.o
...@@ -67,6 +68,7 @@ CBINOUT=_libcclvalue.so \ ...@@ -67,6 +68,7 @@ CBINOUT=_libcclvalue.so \
_libcclmatchrule.so \ _libcclmatchrule.so \
_libcclmatchrulesequence.so \ _libcclmatchrulesequence.so \
_libcclfunctionalopsequence.so \ _libcclfunctionalopsequence.so \
_libccllexicon.so \
_libcclwcclfileopsections.so \ _libcclwcclfileopsections.so \
_wccl.so \ _wccl.so \
_boost_shared_ptr.so _boost_shared_ptr.so
...@@ -95,6 +97,7 @@ CWRAP=libcclvalue_wrap.cxx \ ...@@ -95,6 +97,7 @@ CWRAP=libcclvalue_wrap.cxx \
libcclmatchrule_wrap.cxx \ libcclmatchrule_wrap.cxx \
libcclmatchrulesequence_wrap.cxx \ libcclmatchrulesequence_wrap.cxx \
libcclfunctionalopsequence_wrap.cxx \ libcclfunctionalopsequence_wrap.cxx \
libccllexicon_wrap.cxx \
libcclwcclfileopsections_wrap.cxx \ libcclwcclfileopsections_wrap.cxx \
wccl_wrap.cxx \ wccl_wrap.cxx \
boost_shared_ptr_wrap.cxx boost_shared_ptr_wrap.cxx
...@@ -123,6 +126,7 @@ CWRAPBIN=libcclvalue_wrap.o \ ...@@ -123,6 +126,7 @@ CWRAPBIN=libcclvalue_wrap.o \
libcclmatchrule_wrap.o \ libcclmatchrule_wrap.o \
libcclmatchrulesequence_wrap.o \ libcclmatchrulesequence_wrap.o \
libcclfunctionalopsequence_wrap.o \ libcclfunctionalopsequence_wrap.o \
libccllexicon_wrap.o \
libcclwcclfileopsections_wrap.o \ libcclwcclfileopsections_wrap.o \
wccl_wrap.o \ wccl_wrap.o \
boost_shared_ptr_wrap.o boost_shared_ptr_wrap.o
...@@ -151,6 +155,7 @@ PYMODULES=libcclvalue.py \ ...@@ -151,6 +155,7 @@ PYMODULES=libcclvalue.py \
libcclmatchrule.py \ libcclmatchrule.py \
libcclmatchrulesequence.py \ libcclmatchrulesequence.py \
libcclfunctionalopsequence.py \ libcclfunctionalopsequence.py \
libccllexicon.py \
libcclwcclfileopsections.py \ libcclwcclfileopsections.py \
wccl.py \ wccl.py \
boost_shared_ptr.py boost_shared_ptr.py
...@@ -179,6 +184,7 @@ PYCBIN=libcclvalue.pyc \ ...@@ -179,6 +184,7 @@ PYCBIN=libcclvalue.pyc \
libcclmatchrule.pyc \ libcclmatchrule.pyc \
libcclmatchrulesequence.pyc \ libcclmatchrulesequence.pyc \
libcclfunctionalopsequence.pyc \ libcclfunctionalopsequence.pyc \
libccllexicon.pyc \
libcclwcclfileopsections.pyc \ libcclwcclfileopsections.pyc \
wccl.pyc \ wccl.pyc \
boost_shared_ptr.pyc boost_shared_ptr.pyc
...@@ -374,6 +380,13 @@ libcclfunctionalopsequence.o: ...@@ -374,6 +380,13 @@ libcclfunctionalopsequence.o:
$(CPP) -shared libcclfunctionalopsequence_wrap.o \ $(CPP) -shared libcclfunctionalopsequence_wrap.o \
$(CCLBIN) $(ANTLRLIB) -o _libcclfunctionalopsequence.so $(CCLBIN) $(ANTLRLIB) -o _libcclfunctionalopsequence.so
# Lexicon
libccllexicon.o:
$(SWIG) $(SWIGOPTS_LANG) libccllexicon.i
$(CPP) -c libccllexicon_wrap.cxx -I$(PYTHONDIR) -I$(WCCLDIR) $(CPPFLAGS)
$(CPP) -shared libccllexicon_wrap.o \
$(CCLBIN) $(ANTLRLIB) -o _libccllexicon.so
# WcclFileOpSections # WcclFileOpSections
libcclwcclfileopsections.o: libcclwcclfileopsections.o:
$(SWIG) $(SWIGOPTS_LANG) libcclwcclfileopsections.i $(SWIG) $(SWIGOPTS_LANG) libcclwcclfileopsections.i
......
#ifndef SWIG_LIBWCCL_LEXICON_I
#define SWIG_LIBWCCL_LEXICON_I
%module libccllexicon
%{
#include <libwccl/lexicon/lexicon.h>
#include <libcorpus2/lexeme.h>
#include <boost/unordered_map.hpp>
%}
%include "libcclstrset.i"
%include "std_string.i"
%include "boost_shared_ptr.i"
%rename(map_t) boost::unordered_map<UnicodeString, UnicodeString>;
%nodefaultctor Wccl::Lexicon;
namespace Wccl {
class Lexicon {
public:
typedef boost::unordered_map<UnicodeString, UnicodeString> map_t;
/* --------------------------------------------------------------------- */
Lexicon(const std::string& name, const std::string& file_name);
/* --------------------------------------------------------------------- */
const UnicodeString& translate(const UnicodeString& key) const;
// boost::shared_ptr<StrSet> translate(const StrSet& set) const;
// TODO
// std::string translate_utf8(const std::string&);
/* --------------------------------------------------------------------- */
std::string name() const;
std::string file_name() const;
/* --------------------------------------------------------------------- */
bool has_key(const UnicodeString& key) const;
// TODO
// bool has_key_utf8(const std::string& key) const
/* --------------------------------------------------------------------- */
void insert(const UnicodeString& key, const UnicodeString& value);
void insert(const UnicodeString& key);
// TODO
// void insert_utf8(const std::string& key, const std::string& value);
// void insert_utf8(const std::string& key);
/* --------------------------------------------------------------------- */
const map_t& map() const;
};
}
using namespace boost;
using namespace Wccl;
using namespace std;
#endif /* SWIG_LIBWCCL_LEXICON_I */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment