code: def text2sentences(text, labels):
      '''
      Splits given text at predicted positions from `labels`
      '''
      sentence = ''
      for i, label in enumerate(labels):
          if label == '1':
              if sentence:
                  yield sentence
              sentence = ''
          else:
              sentence += text[i]
      if sentence:
          yield sentencf text2sentences(text, labels):
      '''
      Splits given text at predicted positions from `labels`
      '''
      sentence = ''
      for i, label in enumerate(labels):
          if label == '1':
              if sentence:
                  yield sentence
              sentence = ''
          else:
              sentence += text[i]
      if sentence:
          yield sentence
docs: Splits given text at predicted positions from `labels`