code: def apply(self, mentions):
          
          seen_spans = set()
          for m in mentions:
              if self.f(m) and (
                  not self.longest_match_only
                  or not any([self._is_subspan(m, s) for s in seen_spans])
              ):
                  if self.longest_match_only:
                      seen_spans.add(self._get_span(m))
                  yield m
docs: Apply the Matcher to a **generator** of mentions.
          Optionally only takes the longest match (NOTE: assumes this is the
          *first* match)