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
8aa9c414
Commit
8aa9c414
authored
13 years ago
by
Adam Radziszewski
Browse files
Options
Downloads
Patches
Plain Diff
tagging: token as tag projection
parent
712d1481
Branches
Branches containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libcorpus2/tagging.cpp
+14
-2
14 additions, 2 deletions
libcorpus2/tagging.cpp
libcorpus2/tagging.h
+7
-0
7 additions, 0 deletions
libcorpus2/tagging.h
swig/tagging.i
+5
-1
5 additions, 1 deletion
swig/tagging.i
with
26 additions
and
3 deletions
libcorpus2/tagging.cpp
+
14
−
2
View file @
8aa9c414
...
@@ -15,9 +15,10 @@ or FITNESS FOR A PARTICULAR PURPOSE.
...
@@ -15,9 +15,10 @@ or FITNESS FOR A PARTICULAR PURPOSE.
*/
*/
#include
<libcorpus2/tagging.h>
#include
<libcorpus2/tagging.h>
#include
<libcorpus2/
tagsetmanager
.h>
#include
<libcorpus2/
lexeme
.h>
// #include <libpwrutils/foreach.h>
#include
<libpwrutils/foreach.h>
namespace
Corpus2
{
namespace
Corpus2
{
...
@@ -40,5 +41,16 @@ Tag get_attribute_mask(const Tagset& tagset, std::string attr_name)
...
@@ -40,5 +41,16 @@ Tag get_attribute_mask(const Tagset& tagset, std::string attr_name)
}
}
}
}
Tag
mask_token
(
const
Token
&
token
,
const
Tag
&
mask
,
bool
disamb_only
)
{
Tag
t
;
foreach
(
const
Corpus2
::
Lexeme
&
lexeme
,
token
.
lexemes
())
{
if
(
lexeme
.
is_disamb
()
||
!
disamb_only
)
{
t
.
combine_with
(
lexeme
.
tag
().
get_masked
(
mask
));
}
}
return
t
;
}
}
/* end ns Corpus2 */
}
/* end ns Corpus2 */
This diff is collapsed.
Click to expand it.
libcorpus2/tagging.h
+
7
−
0
View file @
8aa9c414
...
@@ -18,6 +18,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
...
@@ -18,6 +18,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
#define LIBCORPUS2_TAGGING_H
#define LIBCORPUS2_TAGGING_H
#include
<libcorpus2/tag.h>
#include
<libcorpus2/tag.h>
#include
<libcorpus2/token.h>
#include
<libcorpus2/tagset.h>
#include
<libcorpus2/tagset.h>
namespace
Corpus2
{
namespace
Corpus2
{
...
@@ -35,6 +36,12 @@ namespace Corpus2 {
...
@@ -35,6 +36,12 @@ namespace Corpus2 {
Tag
get_attribute_mask
(
const
Tagset
&
tagset
,
Tag
get_attribute_mask
(
const
Tagset
&
tagset
,
const
std
::
string
attr_name
);
const
std
::
string
attr_name
);
/**
* Projects the token onto the mask. Depending on disamb_only, will consider
* only disamb or all lexemes.
*/
Tag
mask_token
(
const
Token
&
token
,
const
Tag
&
mask
,
bool
disamb_only
);
}
/* 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
+
5
−
1
View file @
8aa9c414
...
@@ -10,11 +10,15 @@
...
@@ -10,11 +10,15 @@
%
include
"
tag.i
"
%
include
"
tag.i
"
%
include
"
tagset.i
"
%
include
"
tagset.i
"
%
include
"
token.i
"
namespace
Corpus2
{
namespace
Corpus2
{
Tag get_attribute_mask(const Tagset& tagset,
Tag get_attribute_mask(const Tagset& tagset,
const std::string attr_name);
const std::string attr_name);
Tag mask_token(const Token& token, const Tag& mask, bool disamb_only);
}
}
using
namespace
std
;
using
namespace
std
;
...
...
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