docstr: Given a list of sentences, return the model's results on that text.
docstr_tok: ["Given","a","list","of","sentences",",","return","the","model","'s","results","on","that","text","."]
code: def label_sentences(self, sentences, batch_size=None):
      """
      Given a list of sentences, return the model's results on that text.
      """
      self.eval()
  
      sentences = self.preprocess_sentences(sentences)
  
      if batch_size is None:
          intervals = [(0, len(sentences))]
          orig_idx = None
      else:
          sentences, orig_idx = sort_with_indices(
              sentences, key=len, reverse=True
          )
          intervals = split_into_batches(sentences, batch_size)
      labels = []
      for interval in intervals:
          if interval[1] - interval[0] == 0:
              # this can happen for empty text
              continue
          output = self(sentences[interval[0] : interval[1]])
          predicted = torch.argmax(output, dim=1)
          labels.extend(predicted.tolist())
  
      if orig_idx:
          sentences = unsort(sentences, orig_idx)
          labels = unsort(labels, orig_idx)
  
      logger.debug("Found labels")
      for label, sentence in zip(labels, sentences):
          logger.debug((label, sentence))
  
      return labels
  
file_path: stanza/stanza/models/classifiers/base_classifier.py
imports: from abc import ABC, abstractmethod
  import logging
  import torch
  import torch.nn
  from stanza.models.common.utils import split_into_batches, sort_with_indices, unsort
label_desc: Use image node_id 3 for calling the BaseClassifier obj's underlying member method code with example usage: obj.label_sentences(sentences, batch_size) and returns: labels