Skip to content
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

Fix NER check #1667

Merged
merged 3 commits into from
Oct 3, 2024
Merged

Fix NER check #1667

merged 3 commits into from
Oct 3, 2024

Conversation

BeritJanssen
Copy link
Contributor

Before, the existence of named entities was retrieved from the mappings. I decided to replace this by a search with a query to check if any fields starting with "ner:*" are actually in the documents. Less wordy this way, and with size=0, this request takes only 2-7 milliseconds to perform on the largest corpus we have at the moment (dutchnewspapers-all).

@BeritJanssen BeritJanssen requested review from JeltevanBoheemen and lukavdplas and removed request for JeltevanBoheemen September 27, 2024 09:09
@@ -264,14 +266,15 @@ def clean(self):

@property
def has_named_entities(self):
client = elasticsearch(self.es_index)
from es.search import total_hits
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this line isn't at the top of the file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise it's a circular import, as the es.search module imports addcorpus.models.CorpusConfiguration.

@BeritJanssen BeritJanssen merged commit a38e84d into develop Oct 3, 2024
2 checks passed
@BeritJanssen BeritJanssen deleted the bugfix/ner-check branch October 3, 2024 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants