code: def _build_match_and_apply_functions(pattern, replace):
      def matches_rule(word):
          return re.search(pattern, word)
  
      def apply_rule(word):
          return re.sub(pattern, replace, word)
  
      return (matches_rule, apply_rule)
  
file_path: cltk/src/cltk/lemmatize/naive_lemmatizer.py
imports: import math
  import os
  import re
  from abc import ABC, abstractmethod
  from typing import List, Tuple, Union
  from numpy import argmax
  from cltk.utils import CLTK_DATA_DIR
label_desc: Use image node_id 1 for calling a global function with example usage: _build_match_and_apply_functions(pattern, replace) and returns: matches_rule,  apply_rule, re, re