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
3fd30dde
Commit
3fd30dde
authored
13 years ago
by
Adam Radziszewski
Browse files
Options
Downloads
Patches
Plain Diff
fix tagger-eval script: dont stop when denominator==0
parent
21618b8d
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/tagger-eval.py
+8
-4
8 additions, 4 deletions
utils/tagger-eval.py
with
8 additions
and
4 deletions
utils/tagger-eval.py
+
8
−
4
View file @
3fd30dde
...
...
@@ -304,11 +304,15 @@ class TokComp:
"""
Returns the percentage of reference tokens that have the given
features. By default all the reference tokens are treated as the
denominator. If wrt_to given, will be used as a reference feat set.
"""
if
wrt_to
:
return
100.0
*
self
.
count_with
(
feats
)
/
self
.
count_with
(
wrt_to
)
count
=
self
.
count_with
(
feats
)
if
wrt_to
is
not
None
:
denom
=
self
.
count_with
(
wrt_to
)
else
:
return
100.0
*
self
.
count_with
(
feats
)
/
self
.
ref_toks
denom
=
self
.
ref_toks
if
denom
==
0
:
return
0.0
# what else can we do? should be labelled N/A
return
100.0
*
count
/
denom
def
value_of
(
self
,
metric
):
"""
Calculates the value of the given metric, being a tuple of
features for tokens counted as hit and features for tokens counted
...
...
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