diff --git a/swig/libcclparser.i b/swig/libcclparser.i index 84deead5ea8c3c134e364665a020e78aba6dbb59..2fb924a7656f7182367fc1c4615e6a411612b04d 100644 --- a/swig/libcclparser.i +++ b/swig/libcclparser.i @@ -7,8 +7,16 @@ %} %include "libcclbool.i" +%include "libccltset.i" +%include "libcclstrset.i" +%include "libcclposition.i" %include "libccloperator.i" -%include "libcorpus/libcorpustagsetmanager.i" +// %include "libccltagrule.i" +// %include "libccltagrulesequence.i" +// %include "libcclmatchrule.i" +%include "libcclfunctionaloperator.i" + +%include "libcorpus/libcorpustagset.i" %include "std_string.i" %include "std_vector.i" @@ -17,12 +25,82 @@ namespace Wccl { class Parser { public: - Parser(const Corpus2::Tagset&); - ~TagsetManager(); + explicit Parser(const Corpus2::Tagset&); + explicit Parser(const std::string& tagset_name); + ~Parser(); + + /* --------------------------------------------------------------------- */ + + %exception { + try { + $action + } catch (PwrNlp::PwrNlpError &e) { + PyErr_SetString(PyExc_IndexError, e.info().c_str()); + return NULL; + } + } + shared_ptr<Operator<StrSet> > + parseStringOperator (const std::string& operator_string) const; + + %exception { + try { + $action + } catch (PwrNlp::PwrNlpError &e) { + PyErr_SetString(PyExc_IndexError, e.info().c_str()); + return NULL; + } + } + shared_ptr<Operator<Bool> > + parseBoolOperator (const std::string& operator_string) const; + + %exception { + try { + $action + } catch (PwrNlp::PwrNlpError &e) { + PyErr_SetString(PyExc_IndexError, e.info().c_str()); + return NULL; + } + } + shared_ptr<Operator<TSet> > + parseSymSetOperator (const std::string& operator_string) const; + + %exception { + try { + $action + } catch (PwrNlp::PwrNlpError &e) { + PyErr_SetString(PyExc_IndexError, e.info().c_str()); + return NULL; + } + } + shared_ptr<Operator<Position> > + parsePositionOperator(const std::string& operator_string) const; + + /* --------------------------------------------------------------------- */ + + shared_ptr<FunctionalOperator> + parseAnyOperator(const std::string& operator_string) const; + + /* --------------------------------------------------------------------- */ + // shared_ptr<TagRuleSequence> + // parseTagRuleSequence(const std::string& rule_string) const; + + // shared_ptr<TagRule> + // parseSingleRule(const std::string& rule_string) const; + + // boost::shared_ptr<MatchRule> + // parseMatchRule(const std::string& rule_string) const; + +/* + * NOT IMPLEMENTED YET! + * ------------------------------------------------ + boost::shared_ptr<WcclFile> parseWcclFile( + const std::string& file_contents_string, + const std::string& search_path = ".") const; + */ + /* --------------------------------------------------------------------- */ - // %rename (SharedPtrBoolOperator) boost::shared_ptr<Operator<Bool> >; - shared_ptr<Operator<Bool> > parseBoolOperator(const std::string&) const; + const Corpus2::Tagset& tagset() const; }; }