Skip to content
Discussion options

You must be logged in to vote

Hi @umayerreza, where are you pulling this code snippet from? It is indeed unnecessary to call add_label with the same label over and over again. The function will check if the label is already known and won't do anything if it is, but you're right that it might still introduce a slight overhead. That said the overhead should only occur at the start of the training phase, and the actual training would be much longer in comparison. And you shouldn't have to do this at all when you're using the model for inference.

If you know all your labels up front, you can simply call add_label for each of them once instead of looping through the training data.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@umayerr
Comment options

Answer selected by umayerr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage General spaCy usage training Training and updating models feat / ner Feature: Named Entity Recognizer
2 participants