Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Iobber
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
Syntactic Tools
Chunking
Iobber
Commits
543b5ae9
Commit
543b5ae9
authored
Oct 17, 2012
by
jezozwierzak
Browse files
Options
Downloads
Patches
Plain Diff
Added option --with-heads
parent
e2ebf2b5
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
iobber/chunker.py
+2
-2
2 additions, 2 deletions
iobber/chunker.py
iobber/iobber.py
+4
-1
4 additions, 1 deletion
iobber/iobber.py
with
6 additions
and
3 deletions
iobber/chunker.py
+
2
−
2
View file @
543b5ae9
...
...
@@ -163,7 +163,7 @@ class Chunker:
else
:
non_O_chan
=
chan_name
non_O_tag
=
there_iob
if
chan
.
is_head_at
(
tok_idx
):
if
self
.
with_heads
and
chan
.
is_head_at
(
tok_idx
):
non_O_chan
+=
'
-H
'
# B-NP, I-VP etc. or O
class_label
=
'
O
'
if
non_O_chan
is
None
else
'
%s-%s
'
%
(
non_O_tag
,
non_O_chan
)
...
...
@@ -234,7 +234,7 @@ class Chunker:
# TODO: rename the from_string in corpus2 and fix it here
tag_to_set
=
'
O
'
if
chan_name
!=
non_O_chan
else
non_O_tag
chan
.
set_iob_at
(
tok_idx
,
corpus2
.
from_string
(
tag_to_set
))
if
tag_to_set
!=
'
O
'
and
is_head
:
if
tag_to_set
!=
'
O
'
and
is_head
and
self
.
with_heads
:
chan
.
set_head_at
(
tok_idx
,
True
)
# switch back to segments
for
chan_name
in
chans
:
...
...
This diff is collapsed.
Click to expand it.
iobber/iobber.py
+
4
−
1
View file @
543b5ae9
...
...
@@ -64,6 +64,9 @@ def go():
parser
.
add_option
(
'
-v
'
,
'
--verbose
'
,
action
=
'
store_true
'
,
dest
=
'
verbose
'
,
default
=
False
,
help
=
'
verbose mode
'
)
parser
.
add_option
(
'
--with-heads
'
,
action
=
'
store_true
'
,
dest
=
'
with_heads
'
,
default
=
False
,
help
=
'
Training or chunking with heads mode.
'
)
parser
.
add_option
(
'
--train
'
,
action
=
'
store_true
'
,
dest
=
'
is_training
'
,
help
=
'
train the chunker
'
)
parser
.
add_option
(
'
--batch
'
,
action
=
'
store_true
'
,
...
...
@@ -78,7 +81,7 @@ def go():
files
=
args
[
1
:]
tagr
=
chunker
.
Chunker
(
config_fname
,
options
.
data_dir
,
verbose
=
options
.
verbose
)
verbose
=
options
.
verbose
,
with_heads
=
options
.
with_heads
)
if
options
.
is_training
:
# chunker training
...
...
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