class_docstr: Noise from BART.
class_docstr_tok: ["Noise","from","BART","."]
docstr: Return lengths of each sentence in the token sequence.
docstr_tok: ["Return","lengths","of","each","sentence","in","the","token","sequence","."]
code: def _get_sentence_borders(self, tokens):
      """Return lengths of each sentence in the token sequence."""
      full_stops = np.array(
          [
              True if token in self.full_stop_token else False
              for token in tokens
          ]
      )
      # Pretend it ends with a full stop so last span is a sentence
      full_stops[-1] = True
      # Tokens that are full stops, where the previous token is not
      sentence_lens = (full_stops[1:] * ~full_stops[:-1]).nonzero()[
          0
      ] + 2
      return sentence_lens
  
imports: import math
  import numpy
  import torch
  from typing import Sequence, Callable
  from onmt.constants import DefaultTokens, SubwordMarker
  from onmt.transforms import register_transform
  from .transform import Transform
label_desc: Use image node_id 4 for calling the BARTNoising obj's underlying member method code with example usage: obj._get_sentence_borders(tokens) and returns: sentence_lens