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
fab01c5a
Commit
fab01c5a
authored
13 years ago
by
ilor
Browse files
Options
Downloads
Plain Diff
Merge remote branch 'origin/sentence-cleanup'
parents
2b1b7170
fe9fdb6b
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libwccl/sentencecontext.h
+16
-3
16 additions, 3 deletions
libwccl/sentencecontext.h
with
16 additions
and
3 deletions
libwccl/sentencecontext.h
+
16
−
3
View file @
fab01c5a
...
...
@@ -21,10 +21,12 @@ public:
/// Constructor, wraps the Sentence and sets position to 0
explicit
SentenceContext
(
const
boost
::
shared_ptr
<
Corpus2
::
Sentence
>&
s
);
/// Returns a copy of this with a cloned underlyi
o
ng sentence
/// Returns a copy of this with a cloned underlying sentence
.
SentenceContext
duplicate
()
const
;
/// Cloning -- clones the underlying sentence as well
/// Note: slower than duplicate() and less useful since you should
/// prefer to keep SentenceContexts as values, not pointers
SentenceContext
*
clone
()
const
;
/// Underlying sentence accessor
...
...
@@ -107,7 +109,7 @@ public:
++
position_
;
}
/// Res
t
e position to point to the first token
/// Rese
t
position to point to the first token
void
goto_start
()
{
position_
=
0
;
}
...
...
@@ -152,10 +154,21 @@ public:
return
at
(
position_
);
}
/// Translate a Position into an absolute index into
/// the Sentence wrapped by this SentenceContext.
/// This takes proper care of the special `begin',
/// `end' and `nowhere' Positions.
int
get_abs_position
(
const
Position
&
position
)
const
;
/// Translate a Position into an relative index into
/// the Sentence wrapped by this SentenceContext.
/// (Relative to the current position).
/// This takes proper care of the special `begin',
/// `end' and `nowhere' Positions.
int
get_rel_position
(
const
Position
&
position
)
const
;
/// Helper function for translatin special Positions
/// (`begin', `end' and `nowhere')
int
translate_special_position
(
int
pos
)
const
{
switch
(
pos
)
{
case
Position
::
Begin
:
...
...
@@ -168,8 +181,8 @@ public:
return
position_
+
pos
;
}
}
private
:
private
:
/// The wrapped sentence
boost
::
shared_ptr
<
Corpus2
::
Sentence
>
sentence_
;
...
...
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