docstr: Predicts span clusters based on the word clusters.
  
  Args:
      doc (Doc): the document data
      words (torch.Tensor): [n_words, emb_size] matrix containing
          embeddings for each of the words in the text
      clusters (List[List[int]]): a list of clusters where each cluster
          is a list of word indices
  
  Returns:
      List[List[Span]]: span clusters
code: def predict(
      self, doc: Doc, words: torch.Tensor, clusters: List[List[int]]
  ) -> List[List[Span]]:
      """
      Predicts span clusters based on the word clusters.
  
      Args:
          doc (Doc): the document data
          words (torch.Tensor): [n_words, emb_size] matrix containing
              embeddings for each of the words in the text
          clusters (List[List[int]]): a list of clusters where each cluster
              is a list of word indices
  
      Returns:
          List[List[Span]]: span clusters
      """
      if not clusters:
          return []
  
      heads_ids = torch.tensor(
          sorted(i for cluster in clusters for i in cluster),
          device=self.device,
      )
  
      scores = self(doc, words, heads_ids)
      starts = scores[:, :, 0].argmax(dim=1).tolist()
      ends = (scores[:, :, 1].argmax(dim=1) + 1).tolist()
  
      head2span = {
          head: (start, end)
          for head, start, end in zip(heads_ids.tolist(), starts, ends)
      }
  
      return [
          [head2span[head] for head in cluster] for cluster in clusters
      ]
  
file_path: stanza/stanza/models/coref/span_predictor.py
imports: from typing import List, Optional, Tuple
  from stanza.models.coref.const import Doc, Span
  import torch
label_desc: Use image node_id 5 for calling the SpanPredictor obj's underlying member method code with example usage: obj.predict(doc, words, clusters) and returns: unknown, list