split_text_functions.py 289 B

123456789
  1. def split_by_lines(prompt: str):
  2. prompts = prompt.split("\n")
  3. prompts = [p.strip() for p in prompts]
  4. prompts = [p for p in prompts if len(p) > 0]
  5. return prompts
  6. def split_by_length_simple(prompt: str):
  7. return [prompt[i : i + 200] for i in range(0, len(prompt), 200)]