-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Overlapping Ratio Threshold support #81
Comments
The original code as well as my additions are indeed confusing. This boils down to the CoNLL format, which is based on token-offsets instead char-offsets when I see correctly. Since we have token indices, we have to add one to take into account the last token.
It is baffling that there is still no up-to-date and no-hacky NER evaluation procedure. A huggingface implementation that gets rid of historic assumptions is absolutely desirable. Yet, I don't have the capacity for a HF implementation since NER has not been my focus recently. What is the plan with this repo, @ivyleavedtoadflax @davidsbatista? |
@aflueckiger thanks for your positive feedback. ["Test", "my", "DOUBLE", "ORG"] # len(4) when we want to get the You mean in your data, the entity is recorded as |
Unless I am totally confused, the token indices are not saved as part of the dataset. They are simply an enumeration of the tokens as the text is tokenized the original format (see here for an example). # Token IDs
# 0: Test
# 1: my
# 2: DOUBLE
# 3: ORG
>>> "Test my ORG".split()[2:2]
[]
>>> "Test my ORG".split()[2:3]
['ORG']
>>> "Test my DOUBLE ORG".split()[2:4]
['DOUBLE', 'ORG'] I hope it is clearer now. I fully agree that the code is confusing and needs a complete revamp though. |
Overlapping Ratio
Currently,
find_overlap
will be True when any single overlap occurs.nervaluate/src/nervaluate/evaluate.py
Line 330 in df0e695
nervaluate/src/nervaluate/utils.py
Lines 85 to 104 in df0e695
However, in most cases, we hope there could be an
overlapping ratio threshold
.That is something like this
The current
find_overlap
uses set operation to find overlaps, which seems to be time inefficient. It would be directly obtained viastart
andend
values:Here's my implementation:
Last Character excluded
I wonder why we consider the last token, which is very counter-intuition. This comes from #32. Maybe @aflueckiger could provide any explanation on this? Does your data
end
includes the last character?I think for most data, the start and end are the offsets in the original text string:
text[start:end]
which means the last character is excluded.text[1:3]
andtext[3:5]
don't have any overlapping.nervaluate/src/nervaluate/evaluate.py
Lines 294 to 296 in df0e695
Any support for huggingface Evaluate?
Would the maintainers consider using the standard of huggingface Evaluate? which means inheriting
evaluate.Metric
and pushing to huggingface hub. Afterwards, users could directly callmetric = evaluate.load('{hub_url}')
Example: https://huggingface.co/spaces/evaluate-metric/glue/blob/main/glue.py
The text was updated successfully, but these errors were encountered: