code: def add_weighted_spans(doc, vec, vectorized, target_expl):
      # type: (Any, Any, bool, TargetExplanation) -> None
      
      if vec is None or vectorized:
          return
  
      weighted_spans = get_weighted_spans(doc, vec, target_expl.feature_weights)
      if weighted_spans:
          target_expl.weighted_spans = weighted_spans
docs: Compute and set ``target_expl.weighted_spans`` attribute, when possible.