class_docstr: Search for keywords in text documents
docstr: ```
  search documents for query string.
  Args:
      query(str or list):  the word or phrase to search (or list of them)
                           if list is provided, each element is combined using OR
      docs (list of str): list of text documents
      case_sensitive(bool):  If True, case sensitive search
      substrings_on(bool): whether to use "" in regex. default:True
                           If True, will find substrings
  returns:
      list or tuple:  Returns list of results if len(docs) > 1.  Otherwise, returns tuple of results
  ```
docstr_tok: ["``","`","search","documents","for","query","string",".","Args",":","query","(","str","or","list",")",":","the","word","or","phrase","to","search","(","or","list","of","them",")","if","list","is","provided",",","each","element","is","combined","using","OR","docs","(","list","of","str",")",":","list","of","text","documents","case_sensitive","(","bool",")",":","If","True",",","case","sensitive","search","substrings_on","(","bool",")",":","whether","to","use","``","\b","''","in","regex",".","default",":","True","If","True",",","will","find","substrings","returns",":","list","or","tuple",":","Returns","list","of","results","if","len","(","docs",")",">","1",".","Otherwise",",","returns","tuple","of","results","``","`"]
code: def _search(
      self,
      query,
      docs,
      case_sensitive=False,
      substrings_on=False,
      min_matches=1,
      progress=True,
  ):
      """
      ```
      search documents for query string.
      Args:
          query(str or list):  the word or phrase to search (or list of them)
                               if list is provided, each element is combined using OR
          docs (list of str): list of text documents
          case_sensitive(bool):  If True, case sensitive search
          substrings_on(bool): whether to use "\b" in regex. default:True
                               If True, will find substrings
      returns:
          list or tuple:  Returns list of results if len(docs) > 1.  Otherwise, returns tuple of results
      ```
      """
      if not isinstance(query, (list, tuple, str)):
          raise ValueError("query must be str or list of str")
      if isinstance(query, str):
          query = [query]
      if not isinstance(docs, (list, np.ndarray)):
          raise ValueError("docs must be list of str")
  
      flag = 0
      if not case_sensitive:
          flag = re.I
      qlist = []
      for q in query:
          qlist.append("\s+".join(q.split()))
      original_query = query
      query = "|".join(qlist)
      bound = r"\b"
      if substrings_on:
          bound = ""
      pattern_str = r"%s(?:%s)%s" % (bound, query, bound)
      pattern = re.compile(pattern_str, flag)
  
      results = []
      l = len(docs)
      for idx, text in enumerate(docs):
          matches = pattern.findall(text)
          if matches and len(matches) >= min_matches:
              results.append((idx, text, 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 3 for calling the Searcher obj's underlying member method code with example usage: obj._search(query, docs, case_sensitive, substrings_on, min_matches, progress) and returns: results