code: def resample_document(document: PersonDocument) -> PersonDocument:
      """Randomly remove events from the document"""
      num_records = len(document.sentences)
      num_to_remove = np.random.randint(
          low=int(np.floor(num_records * 0.25)),
          high=int(np.floor((num_records * 0.5))),
          size=1,
      )
      idx_to_remove = set(
          np.random.choice(
              np.arange(0, num_records),
              size=num_to_remove,
              replace=False,
          )
      )
  
      document.sentences = [
          i
          for idx, i in enumerate(document.sentences)
          if idx not in idx_to_remove
      ]
      document.abspos = [
          i
          for idx, i in enumerate(document.abspos)
          if idx not in idx_to_remove
      ]
      document.age = [
          i
          for idx, i in enumerate(document.age)
          if idx not in idx_to_remove
      ]
  
      # Added for v8_1_43
      # Each document should start with [0,1]
      if document.abspos[0] != 1:
          offset = document.abspos[0] - 1
          document.abspos = [
              np.maximum(0, i - offset) for i in document.abspos
          ]
  
      return document
  
file_path: life2vec/src/data_new/augment.py
imports: import random
  import numpy
  from .types import PersonDocument
label_desc: Use image node_id 5 for calling a global function with example usage: resample_document(document) and returns: document