code: def get_unique_sentence_indices( text ):
      ''' Returns a list of sentence indices for the whole text. For each token in text, 
          the list contains index of the sentence the word belongs to, and the indices
          are unique over the whole text. '''
      # Add sentence annotation (if missing)
      if not text.is_tagged( SENTENCES ):
          text.tokenize_sentences()
      # Collect (unique) sent indices over the whole text
      sent_indices = []
      sent_id = 0
      for sub_text in text.split_by( SENTENCES ):
          for word in sub_text.words:
              sent_indices.append( sent_id )
          sent_id += 1
      assert len(sent_indices) == len(text.words), '(!) Number of sent indices should match nr of words!'
      return sent_indicef get_unique_sentence_indices( text ):
      ''' Returns a list of sentence indices for the whole text. For each token in text, 
          the list contains index of the sentence the word belongs to, and the indices
          are unique over the whole text. '''
      # Add sentence annotation (if missing)
      if not text.is_tagged( SENTENCES ):
          text.tokenize_sentences()
      # Collect (unique) sent indices over the whole text
      sent_indices = []
      sent_id = 0
      for sub_text in text.split_by( SENTENCES ):
          for word in sub_text.words:
              sent_indices.append( sent_id )
          sent_id += 1
      assert len(sent_indices) == len(text.words), '(!) Number of sent indices should match nr of words!'
      return sent_indices
docs: Returns a list of sentence indices for the whole text. For each token in text, 
          the list contains index of the sentence the word belongs to, and the indices
          are unique over the whole text.