docstr: Given a doc, split it into chunks (by paragraph).
docstr_tok: ["Given","a","doc",",","split","it","into","chunks","(","by","paragraph",")","."]
code: def _split_doc(self, doc):
      """
      Given a doc, split it into chunks (by paragraph).
      """
      GROUP_LENGTH = 0
      docs = []
      curr = []
      curr_len = 0
      for split in regex.split(r"\n+", doc):
          split = split.strip()
          if len(split) == 0:
              continue
          # Maybe group paragraphs together until we hit a length limit
          if len(curr) > 0 and curr_len + len(split) > GROUP_LENGTH:
              # yield ' '.join(curr)
              docs.append(" ".join(curr))
              curr = []
              curr_len = 0
          curr.append(split)
          curr_len += len(split)
      if len(curr) > 0:
          # yield ' '.join(curr)
          docs.append(" ".join(curr))
      return docs
  
file_path: ParlAI/parlai/agents/retriever_reader/retriever_reader.py
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.agents import Agent
  from parlai.core.agents import create_agent
  import regex
label_desc: Use image node_id 4 for calling the RetrieverReaderAgent obj's underlying member method code with example usage: obj._split_doc(doc) and returns: docs