code: def sentences_from_conll_data(
      corpus_filename, vocabs, attributes, max_sentence_length=1000
  ):
      """Load and returns conll data in list format.
  
      Args:
        corpus_filename: filename of corpus.
        vocabs: dictionary of vocabs
        attributes: list of conll attributes to include into the batch
        max_sentence_length: cut off sentences longer as max tokens
  
      Yields:
          A sentence as a list of tokens while tokens are lists of attributes.
      """
      with tf.io.gfile.GFile(corpus_filename, "rb") as f:
          sentence = create_sentence_with_root(attributes, vocabs)
          for line in codecs.getreader("utf-8")(f):
              line = line.strip()
              if line.startswith("#"):
                  continue
              split = line.split("\t")
              if split[0]:  # Not an empty line, process next token:
                  if len(sentence) < max_sentence_length:
                      if len(attributes) == 1:
                          sentence.append(
                              create_token(split, attributes, vocabs)[0]
                          )
                      else:
                          sentence.append(
                              create_token(split, attributes, vocabs)
                          )
              else:  # Sentences start with an empty line, yield sentence:
                  yield sentence
  
                  # Reset sentence.
                  sentence = create_sentence_with_root(
                      attributes, vocabs
                  )
          if (
              len(sentence) > 1
          ):  # sentences does not only contain a root.
              yield sentence
  
file_path: flax/examples/nlp_seq/input_pipeline.py
imports: import codecs
  import collections
  import enum
  import tensorflow
label_desc: Use image node_id 4 for calling a global function with example usage: sentences_from_conll_data(corpus_filename, vocabs, attributes, max_sentence_length) without return types