docstr: Parameters
  ----------
  metadata : (array like or None)
  
  Returns
  -------
  {'labels':[], 'texts': []} or {'labels':[], 'texts': [], 'meta': []}
docstr_tok: ["Parameters","--","--","--","--","--","metadata",":","(","array","like","or","None",")","Returns","--","--","--","-","{","'labels","'",":","[","]",",","'texts","'",":","[","]","}","or","{","'labels","'",":","[","]",",","'texts","'",":","[","]",",","'meta","'",":","[","]","}"]
code: def get_labels_and_texts(self, metadata=None):
      """
      Parameters
      ----------
      metadata : (array like or None)
  
      Returns
      -------
      {'labels':[], 'texts': []} or {'labels':[], 'texts': [], 'meta': []}
      """
      to_ret = {
          "categories": self._corpus.get_categories(),
          "labels": [],
          "texts": [],
      }
      labels = self._corpus._y.astype(int)
      texts = self._get_texts_to_display()
      if self._use_non_text_features:
          to_ret["extra"] = []
          extrafeats = self._corpus.list_extra_features()
      if metadata is not None:
          to_ret["meta"] = []
      for label_i in range(len(self._corpus._category_idx_store)):
          label_indices = np.arange(0, len(labels))[labels == label_i]
          if self.max_per_category < len(label_indices):
              label_indices = np.random.choice(
                  label_indices, self.max_per_category, replace=False
              )
              to_ret["labels"] += list(
                  [int(e) for e in labels[label_indices]]
              )
              to_ret["texts"] += list(texts[label_indices])
              if metadata is not None:
                  to_ret["meta"] += [metadata[i] for i in label_indices]
              if self._use_non_text_features:
                  to_ret["extra"] += [
                      extrafeats[i] for i in label_indices
                  ]
  
      return to_ret
  
file_path: scattertext/scattertext/DocsAndLabelsFromCorpus.py
imports: import numpy
  import sys
  from scattertext.ParsedCorpus import ParsedCorpus
label_desc: Use image node_id 2 for calling the DocsAndLabelsFromCorpusSample obj's underlying member method code with example usage: obj.get_labels_and_texts(metadata) and returns: to_ret