code: def decode_by_line(texts, encoding="utf-8", verbose=1):
      """
      Decode text line by line and skip over errors.
      """
      if isinstance(texts, str):
          texts = [texts]
      new_texts = []
      skips = 0
      num_lines = 0
      for doc in texts:
          text = ""
          for line in doc.splitlines():
              num_lines += 1
              try:
                  line = line.decode(encoding)
              except:
                  skips += 1
                  continue
              text += line
          new_texts.append(text)
      pct = round((skips * 1.0 / num_lines) * 100, 1)
      if verbose:
          print(
              "skipped %s lines (%s%%) due to character decoding errors"
              % (skips, pct)
          )
          if pct > 10:
              print("If this is too many, try a different encoding")
      return new_texts
  
file_path: ktrain/ktrain/text/shallownlp/utils.py
imports: from .imports import *
label_desc: Use image node_id 5 for calling a global function with example usage: decode_by_line(texts, encoding, verbose) and returns: new_texts