code: def test_overlaps(nlp: Language, lang: str):
      if lang != "en":
          pytest.skip()
  
      def f(doc: Doc) -> Doc:
          doc.ents += (Span(doc, 3, 5, "foo"),)
          return doc
  
      nlp.add_pipe(f, before="PatternSearcher")
  
      doc = nlp("aa bb cc foobar xx ww sss")
      assert len(doc.ents) == 1
      ent = doc.ents[0]
      assert ent.text == "foobar xx"
      assert ent.label_ == "foo"
  
      doc = nlp("aa bb foo bar xx ww sss")
      assert len(doc.ents) == 1
      ent = doc.ents[0]
      assert ent.text == "foo bar"
      assert ent.label_ == "matched"
  
      doc = nlp("lower aa bb foo bar xx ww sss")
      assert len(doc.ents) == 2
      assert [e.text for e in doc.ents] == ["lower", "foo bar"]
      assert [e.label_ for e in doc.ents] == ["matched", "foo"]
  
file_path: camphr/packages/camphr_pattern_search/tests/test_pattern_search.py
imports: import re
  from typing import List
  import pytest
  import spacy
  from spacy.language import Language
  from spacy.tokens import Doc
  from spacy.tokens.span import Span
  from camphr_pattern_search import PatternSearcher
label_desc: Use image node_id 4 for calling a global function with example usage: test_overlaps(nlp, lang) and returns: doc