Adding a custom NER to a pipeline overrides an original NER

Yes, in your code, you’re doing doc.ents = spans, which essentially overrides all entities set by the previous component. One quick fix could be to add the entity matcher before the entity recognizer:

nlp.add_pipe(entity_matcher, before='ner')

spaCy’s entity recognizer should respect pre-defined entities, and it can even improve the predictions, since the entities you’ve set manually will define the constraints for the statistical entity recognizer.

For a more advanced approach that combines and overwrites entities dynamically, you might want to check out the EntityRuler component I developed for the upcoming spaCy v2.1.0 (still experimental). In case you haven’t seen it yet, this thread also discusses similar approaches and strategies.