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
1d5fd937
Commit
1d5fd937
authored
14 years ago
by
Adam Wardynski
Browse files
Options
Downloads
Patches
Plain Diff
Make CatFilter take Function<TSet> isntead of Corpus2::Tag.
parent
aceed854
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide 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
...
@@ -8,8 +8,8 @@ std::string CatFilter::to_string(const Corpus2::Tagset& tagset) const
std
::
ostringstream
os
;
std
::
ostringstream
os
;
os
<<
name
(
tagset
)
<<
"("
os
<<
name
(
tagset
)
<<
"("
<<
pos_expr_
->
to_string
(
tagset
)
<<
", "
<<
pos_expr_
->
to_string
(
tagset
)
<<
", "
<<
tagset
.
get_attribute_name
(
selector_
.
get_values
()
)
<<
", "
<<
selector_expr_
->
to_string
(
tagset
)
<<
", "
<<
tagset
.
get_attribute_name
(
mask_
.
get_values
()
)
<<
")"
;
<<
mask_expr_
->
to_string
(
tagset
)
<<
")"
;
return
os
.
str
();
return
os
.
str
();
}
}
...
@@ -17,8 +17,8 @@ std::ostream& CatFilter::write_to(std::ostream& os) const
...
@@ -17,8 +17,8 @@ std::ostream& CatFilter::write_to(std::ostream& os) const
{
{
return
os
<<
raw_name
()
<<
"("
return
os
<<
raw_name
()
<<
"("
<<
*
pos_expr_
<<
", "
<<
*
pos_expr_
<<
", "
<<
selector_
.
raw_dump
()
<<
", "
<<
*
selector_
expr_
<<
", "
<<
mask_
.
raw_dump
()
<<
")"
;
<<
*
mask_
expr_
<<
")"
;
}
}
CatFilter
::
BaseRetValPtr
CatFilter
::
apply_internal
(
const
FunExecContext
&
context
)
const
CatFilter
::
BaseRetValPtr
CatFilter
::
apply_internal
(
const
FunExecContext
&
context
)
const
...
@@ -29,14 +29,19 @@ CatFilter::BaseRetValPtr CatFilter::apply_internal(const FunExecContext& context
...
@@ -29,14 +29,19 @@ CatFilter::BaseRetValPtr CatFilter::apply_internal(const FunExecContext& context
return
detail
::
DefaultFunction
<
TSet
>
()
->
apply
(
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
>
();
boost
::
shared_ptr
<
TSet
>
tset
=
boost
::
make_shared
<
TSet
>
();
const
Corpus2
::
Token
*
token
=
sc
.
at
(
*
pos
);
const
Corpus2
::
Token
*
token
=
sc
.
at
(
*
pos
);
foreach
(
const
Corpus2
::
Lexeme
&
lexeme
,
token
->
lexemes
())
{
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
->
combine_with
(
lexeme
.
tag
());
}
}
}
}
tset
->
tag_ref
().
mask_with
(
mask
_
);
tset
->
tag_ref
().
mask_with
(
mask
);
return
tset
;
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>
...
@@ -15,16 +15,22 @@ class CatFilter : public Function<TSet>
{
{
public:
public:
typedef
boost
::
shared_ptr
<
Function
<
Position
>
>
PosFunctionPtr
;
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
)
CatFilter
(
:
selector_
(
selector
),
mask_
(
mask
),
pos_expr_
(
pos_expr
)
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
(
pos_expr_
);
BOOST_ASSERT
(
selector_expr_
);
BOOST_ASSERT
(
mask_expr_
);
}
}
/**
/**
* @returns String representation of the function in the form of:
* @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
;
std
::
string
to_string
(
const
Corpus2
::
Tagset
&
tagset
)
const
;
...
@@ -36,8 +42,8 @@ public:
...
@@ -36,8 +42,8 @@ public:
}
}
protected
:
protected
:
Corpus2
::
Tag
selector_
;
const
TSetFunctionPtr
selector_
expr_
;
Corpus2
::
Tag
mask
_
;
const
TSetFunctionPtr
mask_expr
_
;
const
PosFunctionPtr
pos_expr_
;
const
PosFunctionPtr
pos_expr_
;
...
@@ -55,7 +61,7 @@ protected:
...
@@ -55,7 +61,7 @@ protected:
/**
/**
* Writes raw string representation of the function in the form of:
* 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
* @note This version does not require tagset, but will be inclomplete
* and/or contain internal info.
* and/or contain internal info.
* @returns Stream written to.
* @returns Stream written to.
...
...
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