Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
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
corpus2
Commits
e7250075
Commit
e7250075
authored
Oct 27, 2010
by
ilor
Browse files
Options
Downloads
Patches
Plain Diff
add Tagset get_pos_index(mask_t) and get_pos_name(mask_t pos)
parent
69dda1b7
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
libcorpus2/tagset.cpp
+14
-0
14 additions, 0 deletions
libcorpus2/tagset.cpp
libcorpus2/tagset.h
+8
-1
8 additions, 1 deletion
libcorpus2/tagset.h
with
22 additions
and
1 deletion
libcorpus2/tagset.cpp
+
14
−
0
View file @
e7250075
...
...
@@ -420,6 +420,11 @@ const std::string& Tagset::get_pos_name(idx_t pos) const
return
pos_dict_
.
get_string
(
pos
);
}
const
std
::
string
&
Tagset
::
get_pos_name
(
mask_t
pos
)
const
{
return
pos_dict_
.
get_string
(
get_pos_index
(
pos
));
}
mask_t
Tagset
::
get_pos_mask
(
const
string_range
&
pos
)
const
{
return
get_pos_mask
(
get_pos_index
(
pos
));
...
...
@@ -434,6 +439,15 @@ mask_t Tagset::get_pos_mask(idx_t pos) const
}
}
idx_t
Tagset
::
get_pos_index
(
mask_t
pos
)
const
{
if
(
pos
.
none
())
{
return
-
1
;
}
else
{
return
PwrNlp
::
lowest_bit
(
pos
);
}
}
idx_t
Tagset
::
get_attribute_index
(
const
string_range
&
a
)
const
{
return
attribute_dict_
.
get_id
(
a
);
...
...
This diff is collapsed.
Click to expand it.
libcorpus2/tagset.h
+
8
−
1
View file @
e7250075
...
...
@@ -266,7 +266,6 @@ public:
return
attribute_dict_
;
}
/// POS name -> index mapping
/// @returns -1 on invalid name
idx_t
get_pos_index
(
const
string_range
&
pos
)
const
;
...
...
@@ -275,6 +274,10 @@ public:
/// @returns empty string on invalid index
const
std
::
string
&
get_pos_name
(
idx_t
pos
)
const
;
/// POS mask -> name
/// @returns empty string on invalid index
const
std
::
string
&
get_pos_name
(
mask_t
pos
)
const
;
/// POS name -> mask mapping
/// @return null mask on invalid name
mask_t
get_pos_mask
(
const
string_range
&
pos
)
const
;
...
...
@@ -283,6 +286,10 @@ public:
/// @return null mask on invalid index
mask_t
get_pos_mask
(
idx_t
pos
)
const
;
/// POS mask -> index mapping
/// @return -1 on empty mask, unspecified in more tha one POS set
idx_t
get_pos_index
(
mask_t
pos
)
const
;
/// Attribute name -> index mapping
/// @returns -1 on invalid name
...
...
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