code: def load_directory(self, directory, ext=None):
          
          self._say("Loading from directory: " + directory)
  
          if ext is None:
              # Use the default extensions - .rive is preferable.
              ext = ['.rive', '.rs']
          elif type(ext) == str:
              # Backwards compatibility for ext being a string value.
              ext = [ext]
  
          if not os.path.isdir(directory):
              self._warn("Error: " + directory + " is not a directory.")
              return
  
          for root, subdirs, files in os.walk(directory):
              for file in files:
                  for extension in ext:
                      if file.lower().endswith(extension):
                          # Load this file.
                          self.load_file(os.path.join(root, file))
                          break
docs: Load RiveScript documents from a directory.
  
          :param str directory: The directory of RiveScript documents to load
              replies from.
          :param []str ext: List of file extensions to consider as RiveScript
              documents. The default is ``[".rive", ".rs"]``.