Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
1d5fd937
Commit
1d5fd937
authored
Dec 7, 2010
by
Adam Wardynski
Browse files
Options
Downloads
Patches
Plain Diff
Make CatFilter take Function<TSet> isntead of Corpus2::Tag.
parent
aceed854
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
libwccl/ops/functions/tset/catfilter.cpp
+11
-6
11 additions, 6 deletions
libwccl/ops/functions/tset/catfilter.cpp
libwccl/ops/functions/tset/catfilter.h
+12
-6
12 additions, 6 deletions
libwccl/ops/functions/tset/catfilter.h
with
23 additions
and
12 deletions
libwccl/ops/functions/tset/catfilter.cpp
+
11
−
6
View file @
1d5fd937
...
...
@@ -8,8 +8,8 @@ std::string CatFilter::to_string(const Corpus2::Tagset& tagset) const
std
::
ostringstream
os
;
os
<<
name
(
tagset
)
<<
"("
<<
pos_expr_
->
to_string
(
tagset
)
<<
", "
<<
tagset
.
get_attribute_name
(
selector_
.
get_values
()
)
<<
", "
<<
tagset
.
get_attribute_name
(
mask_
.
get_values
()
)
<<
")"
;
<<
selector_expr_
->
to_string
(
tagset
)
<<
", "
<<
mask_expr_
->
to_string
(
tagset
)
<<
")"
;
return
os
.
str
();
}
...
...
@@ -17,8 +17,8 @@ std::ostream& CatFilter::write_to(std::ostream& os) const
{
return
os
<<
raw_name
()
<<
"("
<<
*
pos_expr_
<<
", "
<<
selector_
.
raw_dump
()
<<
", "
<<
mask_
.
raw_dump
()
<<
")"
;
<<
*
selector_
expr_
<<
", "
<<
*
mask_
expr_
<<
")"
;
}
CatFilter
::
BaseRetValPtr
CatFilter
::
apply_internal
(
const
FunExecContext
&
context
)
const
...
...
@@ -29,14 +29,19 @@ CatFilter::BaseRetValPtr CatFilter::apply_internal(const FunExecContext& context
return
detail
::
DefaultFunction
<
TSet
>
()
->
apply
(
context
);
}
const
boost
::
shared_ptr
<
const
TSet
>&
selector_tset
=
selector_expr_
->
apply
(
context
);
const
boost
::
shared_ptr
<
const
TSet
>&
mask_tset
=
mask_expr_
->
apply
(
context
);
const
Corpus2
::
Tag
&
selector
=
selector_tset
->
get_value
();
const
Corpus2
::
Tag
&
mask
=
mask_tset
->
get_value
();
boost
::
shared_ptr
<
TSet
>
tset
=
boost
::
make_shared
<
TSet
>
();
const
Corpus2
::
Token
*
token
=
sc
.
at
(
*
pos
);
foreach
(
const
Corpus2
::
Lexeme
&
lexeme
,
token
->
lexemes
())
{
if
(
!
lexeme
.
tag
().
get_masked
(
selector
_
).
is_null
())
{
if
(
!
lexeme
.
tag
().
get_masked
(
selector
).
is_null
())
{
tset
->
combine_with
(
lexeme
.
tag
());
}
}
tset
->
tag_ref
().
mask_with
(
mask
_
);
tset
->
tag_ref
().
mask_with
(
mask
);
return
tset
;
}
...
...
This diff is collapsed.
Click to expand it.
libwccl/ops/functions/tset/catfilter.h
+
12
−
6
View file @
1d5fd937
...
...
@@ -15,16 +15,22 @@ class CatFilter : public Function<TSet>
{
public:
typedef
boost
::
shared_ptr
<
Function
<
Position
>
>
PosFunctionPtr
;
typedef
boost
::
shared_ptr
<
Function
<
TSet
>
>
TSetFunctionPtr
;
CatFilter
(
const
PosFunctionPtr
&
pos_expr
,
const
Corpus2
::
Tag
&
selector
,
const
Corpus2
::
Tag
&
mask
)
:
selector_
(
selector
),
mask_
(
mask
),
pos_expr_
(
pos_expr
)
CatFilter
(
const
PosFunctionPtr
&
pos_expr
,
const
TSetFunctionPtr
&
selector
,
const
TSetFunctionPtr
&
mask
)
:
selector_expr_
(
selector
),
mask_expr_
(
mask
),
pos_expr_
(
pos_expr
)
{
BOOST_ASSERT
(
pos_expr_
);
BOOST_ASSERT
(
selector_expr_
);
BOOST_ASSERT
(
mask_expr_
);
}
/**
* @returns String representation of the function in the form of:
* "catflt(pos_expr, selector, mask)
* "catflt(pos_expr, selector
_expr
, mask
_expr
)
*/
std
::
string
to_string
(
const
Corpus2
::
Tagset
&
tagset
)
const
;
...
...
@@ -36,8 +42,8 @@ public:
}
protected
:
Corpus2
::
Tag
selector_
;
Corpus2
::
Tag
mask
_
;
const
TSetFunctionPtr
selector_
expr_
;
const
TSetFunctionPtr
mask_expr
_
;
const
PosFunctionPtr
pos_expr_
;
...
...
@@ -55,7 +61,7 @@ protected:
/**
* Writes raw string representation of the function in the form of:
* "catflt(pos_expr_raw_str
ing, raw_selector, raw_mask
)
* "catflt(pos_expr_raw_str
, selector_expr_raw_str, mask_expr_raw_str
)
* @note This version does not require tagset, but will be inclomplete
* and/or contain internal info.
* @returns Stream written to.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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