class_docstr: Search for keywords in text documents
docstr: ```
  executes self.queries on supplied list of documents
  Args:
    docs(list of str): list of chinese texts
    case_sensitive(bool):  If True, case sensitive search
    keys(list): list keys for supplied docs (e.g., file paths).
                default: key is index in range(len(docs))
    min_matches(int): results must have at least these many word matches
    progress(bool): whether or not to show progress bar
  Returns:
    list of tuples of results of the form:
      (key, query, no. of matches)
    For Chinese, no. of matches will be number of unique Jieba-extracted character sequences that match
  ```
docstr_tok: ["``","`","executes","self.queries","on","supplied","list","of","documents","Args",":","docs","(","list","of","str",")",":","list","of","chinese","texts","case_sensitive","(","bool",")",":","If","True",",","case","sensitive","search","keys","(","list",")",":","list","keys","for","supplied","docs","(","e.g.",",","file","paths",")",".","default",":","key","is","index","in","range","(","len","(","docs",")",")","min_matches","(","int",")",":","results","must","have","at","least","these","many","word","matches","progress","(","bool",")",":","whether","or","not","to","show","progress","bar","Returns",":","list","of","tuples","of","results","of","the","form",":","(","key",",","query",",","no",".","of","matches",")","For","Chinese",",","no",".","of","matches","will","be","number","of","unique","Jieba-extracted","character","sequences","that","match","``","`"]
code: def search(
      self,
      docs,
      case_sensitive=False,
      keys=[],
      min_matches=1,
      progress=True,
  ):
      """
      ```
      executes self.queries on supplied list of documents
      Args:
        docs(list of str): list of chinese texts
        case_sensitive(bool):  If True, case sensitive search
        keys(list): list keys for supplied docs (e.g., file paths).
                    default: key is index in range(len(docs))
        min_matches(int): results must have at least these many word matches
        progress(bool): whether or not to show progress bar
      Returns:
        list of tuples of results of the form:
          (key, query, no. of matches)
        For Chinese, no. of matches will be number of unique Jieba-extracted character sequences that match
      ```
      """
      if isinstance(docs, str):
          docs = [docs]
      if keys and len(keys) != len(docs):
          raise ValueError("lengths of keys and docs must be the same")
      results = []
      l = len(docs)
      for idx, text in enumerate(docs):
          for q in self.queries:
              if U.is_chinese(self.lang):
                  r = self._search_chinese(
                      q,
                      [text],
                      min_matches=min_matches,
                      parse=1,
                      progress=False,
                  )
              elif self.lang == "ar":
                  r = self._search(
                      q,
                      [text],
                      case_sensitive=case_sensitive,
                      min_matches=min_matches,
                      progress=False,
                      substrings_on=True,
                  )
              else:
                  r = self._search(
                      q,
                      [text],
                      case_sensitive=case_sensitive,
                      min_matches=min_matches,
                      progress=False,
                      substrings_on=False,
                  )
              if not r:
                  continue
              r = r[0]
              k = idx
              if keys:
                  k = keys[idx]
              num_matches = (
                  len(set(r[2]))
                  if U.is_chinese(self.lang)
                  else len(r[2])
              )
              results.append((k, q, num_matches))
          if progress:
              printProgressBar(
                  idx + 1,
                  l,
                  prefix="progress: ",
                  suffix="complete",
                  length=50,
              )
      return results
  
file_path: ktrain/ktrain/text/shallownlp/searcher.py
imports: from .None import utils
  from .imports import *
label_desc: Use image node_id 2 for calling the Searcher obj's underlying member method code with example usage: obj.search(docs, case_sensitive, keys, min_matches, progress) and returns: results