Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
bae8dd09
Commit
bae8dd09
authored
14 years ago
by
Adam Wardynski
Browse files
Options
Downloads
Patches
Plain Diff
agrpp, point-to-point strong agreement operator.
parent
631c5f87
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libwccl/ops/functions/bool/predicates/pointagreement.cpp
+23
-5
23 additions, 5 deletions
libwccl/ops/functions/bool/predicates/pointagreement.cpp
with
23 additions
and
5 deletions
libwccl/ops/functions/bool/predicates/pointagreement.cpp
+
23
−
5
View file @
bae8dd09
...
...
@@ -33,12 +33,30 @@ PointAgreement::BaseRetValPtr PointAgreement::apply_internal(const FunExecContex
return
Predicate
::
False
(
context
);
}
const
boost
::
shared_ptr
<
const
TSet
>&
attribs_tset
=
attribs_expr_
->
apply
(
context
);
const
Corpus2
::
Tag
&
attribs
=
attribs_tset
->
get_value
();
const
boost
::
shared_ptr
<
const
TSet
>&
attribs
=
attribs_expr_
->
apply
(
context
);
//
// @todo: implement
//
int
min_card
=
attribs
->
categories_count
(
tagset_
);
const
Corpus2
::
Token
*
t1
=
sc
.
at
(
*
pos1
);
const
Corpus2
::
Token
*
t2
=
sc
.
at
(
*
pos2
);
// to optimize a bit, make sure t1 is the one with less lexemes
if
(
t1
->
lexemes
().
size
()
>
t2
->
lexemes
().
size
())
{
std
::
swap
(
t1
,
t2
);
}
foreach
(
const
Corpus2
::
Lexeme
&
t1_lex
,
t1
->
lexemes
())
{
const
Corpus2
::
Tag
&
t1_tag
=
t1_lex
.
tag
();
// don't bother checking t2 unless current t1_tag matches enough categories
if
(
attribs
->
matching_categories
(
t1_tag
)
>=
min_card
)
{
foreach
(
const
Corpus2
::
Lexeme
&
t2_lex
,
t2
->
lexemes
())
{
Corpus2
::
Tag
&
intersection
=
t1_tag
.
get_masked
(
t2_lex
.
tag
());
// if the intersection matches enough categories we have agreement
if
(
attribs
->
matching_categories
(
intersection
)
>=
min_card
)
{
return
Predicate
::
True
(
context
);
}
}
}
}
return
Predicate
::
False
(
context
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment