code: def __sentence_segments_from_subtokens(
      self, sentence_df: pd.DataFrame
  ) -> pd.DataFrame:
      inside_segment = False
      current_segment = 0
      tokens_in_segment = 0
      sentence_segments = []
      for sentence_id, row in sentence_df.iterrows():
          if inside_segment:
              tokens_in_segment += row.Length
          if int(sentence_id) == sentence_id:
              if inside_segment is False:
                  inside_segment = True
              potential_additional_tokens = 0
              if sentence_id + 0.5 in sentence_df.index:
                  potential_additional_tokens += sentence_df.loc[
                      sentence_id + 0.5
                  ].Length
              if sentence_id + 1 in sentence_df.index:
                  potential_additional_tokens += sentence_df.loc[
                      sentence_id + 1
                  ].Length
              sentence_segments.append(current_segment)
              if (
                  tokens_in_segment + potential_additional_tokens
                  <= self.max_segment_size
              ):
                  tokens_in_segment += potential_additional_tokens
              else:
                  tokens_in_segment = 0
                  current_segment += 1
                  inside_segment = False
          else:
              sentence_segments.append(
                  current_segment if inside_segment else -1
              )
      return sentence_segments
  
file_path: scattertext/scattertext/contextual_embeddings/doc_splitter.py
imports: from typing import Iterable, Callable
  import numpy
  import pandas
  import spacy
label_desc: Use image node_id 4 for calling the SubwordSensitiveSentenceBoundedSplitter obj's underlying member method code with example usage: obj.__sentence_segments_from_subtokens(sentence_df) and returns: sentence_segments