Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
macaon_data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Franck Dary
macaon_data
Commits
cd0e0326
Commit
cd0e0326
authored
4 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Fixed problem in conll18 eval where numeric column wasn't detected
parent
265848ed
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/conll18_ud_eval.py
+6
-8
6 additions, 8 deletions
scripts/conll18_ud_eval.py
with
6 additions
and
8 deletions
scripts/conll18_ud_eval.py
+
6
−
8
View file @
cd0e0326
...
...
@@ -146,10 +146,10 @@ UNIVERSAL_FEATURES = {
def
is_float
(
value
)
:
if
not
isinstance
(
value
,
str
)
:
return
False
try
:
try
:
float
(
value
)
return
'
.
'
in
val
ue
except
ValueError
:
return
Tr
ue
except
ValueError
:
return
False
################################################################################
...
...
@@ -165,14 +165,12 @@ def filter_columns(columns) :
return
res
################################################################################
################################################################################
# UD Error is used when raising exceptions in this module
class
UDError
(
Exception
)
:
pass
################################################################################
################################################################################
# Conversion methods handling `str` <-> `unicode` conversions in Python2
def
_decode
(
text
)
:
...
...
@@ -435,8 +433,9 @@ def evaluate(gold_ud, system_ud, extraColumns) :
if
filter_fn
is
None
or
filter_fn
(
words
.
gold_word
)
:
goldItem
=
key_fn
(
words
.
gold_word
,
gold_aligned_gold
)
systemItem
=
key_fn
(
words
.
system_word
,
gold_aligned_system
)
if
(
not
is
instance
(
systemItem
,
str
)
or
'
.
'
not
in
systemItem
or
not
is_float
(
systemItem
))
or
(
not
isinstance
(
goldItem
,
str
)
or
'
.
'
not
in
goldItem
or
not
is_float
(
goldItem
))
:
if
(
not
is
_float
(
systemItem
))
or
(
not
is_float
(
goldItem
))
:
isNumericOnly
=
False
break
correct
=
[
0
,
0
]
errors
=
[]
...
...
@@ -451,8 +450,7 @@ def evaluate(gold_ud, system_ud, extraColumns) :
correct
[
0
]
+=
1
else
:
errors
.
append
(
words
)
# WARNING: this script ignore examples where gold value == 0.0
elif
float
(
goldItem
)
!=
0.0
:
else
:
correct
[
0
]
-=
abs
(
float
(
goldItem
)
-
float
(
systemItem
))
**
1
correct
[
1
]
-=
abs
(
float
(
goldItem
)
-
float
(
systemItem
))
**
2
goldValues
.
append
(
float
(
goldItem
))
...
...
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