Closed davidsbatista closed 1 year ago
This looks good, but do you think it is worth being more explicit about the dependencies required for the new example, as it won't run out of the box as it is?
probably yes, I'm not having the whole picture, can you give a concrete example?
in the meantime, I will just merge this, if you agree.
my point was that if you try to run the example without installing the dependencies, it failed, and there's no way to know what you need to install except by running the script and seeing the various errors like:
(virtualenv) AWS: mantis ~/Documents/mantis/nervaluate NEW/add-code-with-examples python examples/example_no_loader.py <aws:mantis>
Loading CoNLL 2002 NER Spanish data
Traceback (most recent call last):
File "/home/matthew/Documents/mantis/nervaluate/build/virtualenv/lib/python3.8/site-packages/nltk/corpus/util.py", line 84, in __load
root = nltk.data.find(f"{self.subdir}/{zip_name}")
File "/home/matthew/Documents/mantis/nervaluate/build/virtualenv/lib/python3.8/site-packages/nltk/data.py", line 583, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource conll2002 not found.
Please use the NLTK Downloader to obtain the resource:
>>> import nltk
>>> nltk.download('conll2002')
For more information see: https://www.nltk.org/data.html
Attempted to load corpora/conll2002.zip/conll2002/
Searched in:
- '/home/matthew/nltk_data'
- '/home/matthew/Documents/mantis/nervaluate/build/virtualenv/nltk_data'
- '/home/matthew/Documents/mantis/nervaluate/build/virtualenv/share/nltk_data'
- '/home/matthew/Documents/mantis/nervaluate/build/virtualenv/lib/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
**********************************************************************
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "examples/example_no_loader.py", line 120, in <module>
main()
File "examples/example_no_loader.py", line 71, in main
nltk.corpus.conll2002.fileids()
File "/home/matthew/Documents/mantis/nervaluate/build/virtualenv/lib/python3.8/site-packages/nltk/corpus/util.py", line 121, in __getattr__
self.__load()
File "/home/matthew/Documents/mantis/nervaluate/build/virtualenv/lib/python3.8/site-packages/nltk/corpus/util.py", line 86, in __load
raise e
File "/home/matthew/Documents/mantis/nervaluate/build/virtualenv/lib/python3.8/site-packages/nltk/corpus/util.py", line 81, in __load
root = nltk.data.find(f"{self.subdir}/{self.__name}")
File "/home/matthew/Documents/mantis/nervaluate/build/virtualenv/lib/python3.8/site-packages/nltk/data.py", line 583, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource conll2002 not found.
Please use the NLTK Downloader to obtain the resource:
>>> import nltk
>>> nltk.download('conll2002')
For more information see: https://www.nltk.org/data.html
Attempted to load corpora/conll2002
Searched in:
- '/home/matthew/nltk_data'
- '/home/matthew/Documents/mantis/nervaluate/build/virtualenv/nltk_data'
- '/home/matthew/Documents/mantis/nervaluate/build/virtualenv/share/nltk_data'
- '/home/matthew/Documents/mantis/nervaluate/build/virtualenv/lib/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
**********************************************************************
(virtualenv) ✘ AWS: mantis ~/Documents/mantis/nervaluate NEW/add-code-with-examples
Might be nice to include a list of dependencies for the example somewhere.
ah ok - I see your point - I will try to fix this
Also it seems like line 11 of the Makefile is failing on my system:
source ${VIRTUALENV}/bin/activate && pip3 install --editable .
Do you have any thoughts about moving to poetry for managing dependencies/build/upload to pypi etc? This would also resolve any virtualenv issues
I've never worked with poetry - have you before?
I'm looking into poetry
I've never worked with poetry - have you before?
I'm looking into poetry
yes, we started recently, and it's actually pretty good!
sorry Matt I have too much on my plate - I will merge but let's keep in mind to use poetry for deps + dev env. managing
Main Changes
Added two new functions:
summary_report_ent()
: print of the evaluation results, aggregated by entity type and for a specific given scenario (i.e.,strict
,ent_type
,partial
,exact
)summary_report_overall()
: the report over all entities for the 4 possible scenariosExample of the output:
Other "minor" changes:
examples/example_no_loader.py
pre-commit
andsetup.cfg
stuff, so thatmypy
is not applied totests/
andexamples/
make clean_venv
only to remove the virtual environmentcodecov
being now non-existentcollect_named_entities()
was duplicated, removed it from one filenerevaluate.py
and updated the type definition since it was wrongnerevauate.py
toevaluate.py
since I was having lots of conflicts, was the easiast fixe