code: def _get_spans_from_matches(
      self,
      matches: Iterable[Tuple[int, int, str]],
      tokens: List[Tuple[int, int]],
  ) -> Iterator[Tuple[int, int]]:
      idx = sorted((i, j) for i, j, _ in matches)
      spans = textspan.lift_spans_index(idx, tokens)
      for (l, l_ok), (r, r_ok) in spans:
          if self.extend_span_to_token_boundary or (l_ok and r_ok):
              yield (l, r)
  
file_path: camphr/packages/camphr_pattern_search/camphr_pattern_search/__init__.py
imports: import itertools
  from typing import Callable, Iterable, Iterator, List, Optional, Tuple
  import ahocorasick
  from spacy.tokens.token import Token
  import textspan
  from spacy.tokens import Doc, Span
label_desc: Use image node_id 4 for calling the PatternSearcher obj's underlying member method code with example usage: obj._get_spans_from_matches(matches, tokens) without return types