code: def get_sentence(
      response, sentence_state, is_final=False, verbose=False
  ):
      # get state items
      sentence_list, index = unpack_state(sentence_state)
      sentences = _get_sentences(
          response[index:],
          min_start=15 if index == 0 else 0,
          verbose=verbose,
      )
  
      if len(sentences) >= 2:
          # detected new completed sentence
          # find new index
          index_delta = response[index:].index(sentences[0])
          index += index_delta + len(sentences[0])
          sentence_list.append(sentences[0])
          # only clean for result, to avoid mis-handling of sentences index
          cleaned_sentence = clean_sentence(
              sentences[0], verbose=verbose
          )
          return (
              cleaned_sentence,
              pack_state(sentence_state, sentence_list, index),
              False,
          )
      elif is_final:
          # then just return last sentence
          cleaned_sentence = clean_sentence(
              " ".join(sentences), verbose=verbose
          )
          sentence_list.append(" ".join(sentences))
          return (
              cleaned_sentence,
              pack_state(sentence_state, sentence_list, index),
              True,
          )
      else:
          return (
              None,
              pack_state(sentence_state, sentence_list, index),
              True,
          )
  
file_path: h2ogpt/src/tts_sentence_parsing.py
imports: import textwrap
  import re
  from src.utils import flatten_list, have_emoji, have_langid
label_desc: Use image node_id 7 for calling a global function with example usage: get_sentence(response, sentence_state, is_final, verbose) and returns: cleaned_sentence,  pack_state,  False, cleaned_sentence,  pack_state,  True, None,  pack_state,  True