Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
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
corpus2
Commits
d998c411
There was an error fetching the commit references. Please try again later.
Commit
d998c411
authored
12 years ago
by
Adam Radziszewski
Browse files
Options
Downloads
Patches
Plain Diff
add with_values_masked Tag function
parent
6b9ad465
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
libcorpus2/tagging.cpp
+6
-0
6 additions, 0 deletions
libcorpus2/tagging.cpp
libcorpus2/tagging.h
+8
-0
8 additions, 0 deletions
libcorpus2/tagging.h
swig/tagging.i
+2
-0
2 additions, 0 deletions
swig/tagging.i
with
17 additions
and
1 deletion
CMakeLists.txt
+
1
−
1
View file @
d998c411
...
@@ -2,7 +2,7 @@ PROJECT(Corpus2Library)
...
@@ -2,7 +2,7 @@ PROJECT(Corpus2Library)
set
(
corpus2_ver_major
"1"
)
set
(
corpus2_ver_major
"1"
)
set
(
corpus2_ver_minor
"3"
)
set
(
corpus2_ver_minor
"3"
)
set
(
corpus2_ver_patch
"
0
"
)
set
(
corpus2_ver_patch
"
1
"
)
cmake_minimum_required
(
VERSION 2.8.0
)
cmake_minimum_required
(
VERSION 2.8.0
)
...
...
This diff is collapsed.
Click to expand it.
libcorpus2/tagging.cpp
+
6
−
0
View file @
d998c411
...
@@ -59,6 +59,12 @@ int mask_card(const Tag& mask)
...
@@ -59,6 +59,12 @@ int mask_card(const Tag& mask)
+
PwrNlp
::
count_bits_set
(
mask
.
get_values
());
+
PwrNlp
::
count_bits_set
(
mask
.
get_values
());
}
}
Tag
with_values_masked
(
Tag
input
,
Tag
attr_value
,
Tag
attr_mask
)
{
Tag
output
(
input
);
output
.
add_values_masked
(
attr_value
.
get_values
(),
attr_mask
.
get_values
());
return
output
;
}
bool
select_preferred_disamb
(
const
Tagset
&
tagset
,
Token
*
token
)
bool
select_preferred_disamb
(
const
Tagset
&
tagset
,
Token
*
token
)
{
{
size_t
lex_idx
=
token
->
get_preferred_lexeme_index
(
tagset
);
size_t
lex_idx
=
token
->
get_preferred_lexeme_index
(
tagset
);
...
...
This diff is collapsed.
Click to expand it.
libcorpus2/tagging.h
+
8
−
0
View file @
d998c411
...
@@ -45,6 +45,13 @@ Tag mask_token(const Token& token, const Tag& mask, bool disamb_only);
...
@@ -45,6 +45,13 @@ Tag mask_token(const Token& token, const Tag& mask, bool disamb_only);
/** Returns the number of set elements belonging to the mask given. */
/** Returns the number of set elements belonging to the mask given. */
int
mask_card
(
const
Tag
&
mask
);
int
mask_card
(
const
Tag
&
mask
);
/**
* Returns a copy of the given input tag with the attribute referred
* to by attr_mask value set to attr_value (possibly empty).
* NOTE: only attribute part of the masks are considered.
*/
Tag
with_values_masked
(
Tag
input
,
Tag
attr_value
,
Tag
attr_mask
);
/** Forces one disamb lexeme per token. The selection is based on tagset
/** Forces one disamb lexeme per token. The selection is based on tagset
* definition order. Returns if any disamb found.
* definition order. Returns if any disamb found.
*/
*/
...
@@ -99,6 +106,7 @@ bool disambiguate_subset(Token* token, const Tag& mask_where,
...
@@ -99,6 +106,7 @@ bool disambiguate_subset(Token* token, const Tag& mask_where,
/** Sets lexemes' disamb markers iff lexeme.tag is wanted_tag. */
/** Sets lexemes' disamb markers iff lexeme.tag is wanted_tag. */
void
set_disambs
(
Token
*
token
,
const
Tag
&
wanted_tag
);
void
set_disambs
(
Token
*
token
,
const
Tag
&
wanted_tag
);
}
/* end ns Corpus2 */
}
/* end ns Corpus2 */
#endif // LIBCORPUS2_TAGGING_H
#endif // LIBCORPUS2_TAGGING_H
This diff is collapsed.
Click to expand it.
swig/tagging.i
+
2
−
0
View file @
d998c411
...
@@ -21,6 +21,8 @@ Tag mask_token(const Token& token, const Tag& mask, bool disamb_only);
...
@@ -21,6 +21,8 @@ Tag mask_token(const Token& token, const Tag& mask, bool disamb_only);
int mask_card(const Tag& mask);
int mask_card(const Tag& mask);
Tag with_values_masked(Tag input, Tag attr_value, Tag attr_mask);
bool select_preferred_disamb(const Tagset& tagset, Token* token);
bool select_preferred_disamb(const Tagset& tagset, Token* token);
void select_preferred_lexeme(const Tagset& tagset, Token* token);
void select_preferred_lexeme(const Tagset& tagset, Token* token);
...
...
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