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

Added rules for parsing agreement operator (agr, agrpp, wagr)

parent d2486931
Branches
No related merge requests found
......@@ -23,16 +23,19 @@ header {
#include <libwccl/ops/functions/vargetter.h>
#include <libwccl/ops/functions/conditional.h>
#include <libwccl/ops/functions/bool/varsetter.h>
#include <libwccl/ops/functions/bool/predicates/or.h>
#include <libwccl/ops/functions/bool/predicates/nor.h>
#include <libwccl/ops/functions/bool/predicates/and.h>
#include <libwccl/ops/functions/bool/predicates/regex.h>
#include <libwccl/ops/functions/bool/varsetter.h>
#include <libwccl/ops/functions/bool/predicates/intersects.h>
#include <libwccl/ops/functions/bool/predicates/issubsetof.h>
#include <libwccl/ops/functions/bool/predicates/isinside.h>
#include <libwccl/ops/functions/bool/predicates/isoutside.h>
#include <libwccl/ops/functions/bool/predicates/equals.h>
#include <libwccl/ops/functions/bool/predicates/weakagreement.h>
#include <libwccl/ops/functions/bool/predicates/pointagreement.h>
#include <libwccl/ops/functions/bool/predicates/strongagreement.h>
#include <libwccl/ops/functions/strset/affix.h>
#include <libwccl/ops/functions/strset/getorth.h>
......@@ -822,6 +825,8 @@ bool_operator
| ret = inter_operator [tagset, vars]
// iterations
| ret = bool_iteration [tagset, vars]
// agreement
| ret = bool_agreement [tagset, vars]
//
| LPAREN ret = bool_operator [tagset, vars] RPAREN
;
......@@ -1109,6 +1114,38 @@ bool_iteration
}
;
// ----------------------------------------------------------------------------
// Agreement operator: agr, agrpp, wagr
bool_agreement
[const Corpus2::Tagset& tagset, Variables& vars]
returns [boost::shared_ptr<Function<Bool> > ret]
{
boost::shared_ptr<Function<TSet> > expr;
boost::shared_ptr<Function<Position> > lpos, rpos;
}
: "agr" LPAREN
lpos = position_operator [tagset, vars] COMMA
rpos = position_operator [tagset, vars] COMMA
expr = symset_operator [tagset, vars]
RPAREN {
ret.reset(new StrongAgreement(lpos, rpos, expr, tagset));
}
| "agrpp" LPAREN
lpos = position_operator [tagset, vars] COMMA
rpos = position_operator [tagset, vars] COMMA
expr = symset_operator [tagset, vars]
RPAREN {
ret.reset(new PointAgreement(lpos, rpos, expr, tagset));
}
| "wagr" LPAREN
lpos = position_operator [tagset, vars] COMMA
rpos = position_operator [tagset, vars] COMMA
expr = symset_operator [tagset, vars]
RPAREN {
ret.reset(new WeakAgreement(lpos, rpos, expr, tagset));
}
;
// ----------------------------------------------------------------------------
// Setvar operator
// Returns boost::shared_ptr<Function<Bool> >
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment