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
ec560597
There was an error fetching the commit references. Please try again later.
Commit
ec560597
authored
13 years ago
by
Adam Radziszewski
Browse files
Options
Downloads
Patches
Plain Diff
tagging utils
parent
2f02ba57
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libcorpus2/tagging.cpp
+13
-2
13 additions, 2 deletions
libcorpus2/tagging.cpp
libcorpus2/tagging.h
+6
-0
6 additions, 0 deletions
libcorpus2/tagging.h
swig/tagging.i
+2
-0
2 additions, 0 deletions
swig/tagging.i
with
21 additions
and
2 deletions
libcorpus2/tagging.cpp
+
13
−
2
View file @
ec560597
...
@@ -59,8 +59,7 @@ int mask_card(const Tag& mask)
...
@@ -59,8 +59,7 @@ int mask_card(const Tag& mask)
+
PwrNlp
::
count_bits_set
(
mask
.
get_values
());
+
PwrNlp
::
count_bits_set
(
mask
.
get_values
());
}
}
bool
select_preferred_disamb
(
const
Tagset
&
tagset
,
bool
select_preferred_disamb
(
const
Tagset
&
tagset
,
Token
*
token
)
Token
*
token
)
{
{
size_t
lex_idx
=
token
->
get_preferred_lexeme_index
(
tagset
);
size_t
lex_idx
=
token
->
get_preferred_lexeme_index
(
tagset
);
if
(
!
token
->
lexemes
()[
lex_idx
].
is_disamb
())
{
if
(
!
token
->
lexemes
()[
lex_idx
].
is_disamb
())
{
...
@@ -77,6 +76,18 @@ bool select_preferred_disamb(const Tagset& tagset,
...
@@ -77,6 +76,18 @@ bool select_preferred_disamb(const Tagset& tagset,
return
true
;
return
true
;
}
}
void
select_preferred_lexeme
(
const
Tagset
&
tagset
,
Token
*
token
)
{
foreach
(
Lexeme
&
lex
,
token
->
lexemes
())
{
lex
.
set_disamb
(
true
);
}
if
(
token
->
lexemes
().
size
()
>
1
)
{
std
::
vector
<
Lexeme
>
one
;
one
.
push_back
(
token
->
get_preferred_lexeme
(
tagset
));
token
->
replace_lexemes
(
one
);
}
}
void
expand_optional_attrs
(
const
Tagset
&
tagset
,
Token
*
token
)
void
expand_optional_attrs
(
const
Tagset
&
tagset
,
Token
*
token
)
{
{
foreach
(
Lexeme
&
lex
,
token
->
lexemes
())
{
foreach
(
Lexeme
&
lex
,
token
->
lexemes
())
{
...
...
This diff is collapsed.
Click to expand it.
libcorpus2/tagging.h
+
6
−
0
View file @
ec560597
...
@@ -50,6 +50,12 @@ int mask_card(const Tag& mask);
...
@@ -50,6 +50,12 @@ int mask_card(const Tag& mask);
*/
*/
bool
select_preferred_disamb
(
const
Tagset
&
tagset
,
Token
*
token
);
bool
select_preferred_disamb
(
const
Tagset
&
tagset
,
Token
*
token
);
/** Forces one lexeme per token. The selection is based on tagset
* definition order, disamb markers are not respected.
* The selected lexeme will be set to disamb=True.
*/
void
select_preferred_lexeme
(
const
Tagset
&
tagset
,
Token
*
token
);
/** Encodes optional attributes with unspecified values as each value set.
/** Encodes optional attributes with unspecified values as each value set.
* This is to facilitate safe masking when the value in question is not to be
* This is to facilitate safe masking when the value in question is not to be
* skipped.
* skipped.
...
...
This diff is collapsed.
Click to expand it.
swig/tagging.i
+
2
−
0
View file @
ec560597
...
@@ -23,6 +23,8 @@ int mask_card(const Tag& mask);
...
@@ -23,6 +23,8 @@ int mask_card(const Tag& 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 expand_optional_attrs(const Tagset& tagset, Token* token);
void expand_optional_attrs(const Tagset& tagset, Token* token);
void select_singular_tags(const Tagset& tagset, Token* token);
void select_singular_tags(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