code: def test_entity_ruler_existing(nlp, patterns, entity_ruler_factory):
      ruler = nlp.add_pipe(entity_ruler_factory, name="entity_ruler")
      ruler.add_patterns(patterns)
      nlp.add_pipe("add_ent", before="entity_ruler")
      doc = nlp("OH HELLO WORLD bye bye")
      assert len(doc.ents) == 2
      assert doc.ents[0].label_ == "ORG"
      assert doc.ents[1].label_ == "BYE"
  
imports: import pytest
  from thinc.api import NumpyOps, get_current_ops
  from spacy import registry
  from spacy.errors import MatchPatternError
  from spacy.lang.en import English
  from spacy.language import Language
  from spacy.pipeline import EntityRecognizer, EntityRuler, SpanRuler, merge_entities
  from spacy.pipeline.ner import DEFAULT_NER_MODEL
  from spacy.tests.util import make_tempdir
  from spacy.tokens import Doc, Span
label_desc: Use image node_id 14 for calling a global function with example usage: test_entity_ruler_existing(nlp, patterns, entity_ruler_factory) without return types