code: def create_text_and_labels(
      output_dir: str, file_path: str, punct_marks: str = ",.?"
  ):
      """
      Create datasets for training and evaluation.
  
      Args:
        output_dir: path to the output data directory
        file_path: path to file name
        punct_marks: supported punctuation marks
  
      The data will be split into 2 files: text.txt and labels.txt. \
      Each line of the text.txt file contains text sequences, where words\
      are separated with spaces. The labels.txt file contains \
      corresponding labels for each word in text.txt, the labels are \
      separated with spaces. Each line of the files should follow the \
      format:  \
      [WORD] [SPACE] [WORD] [SPACE] [WORD] (for text.txt) and \
      [LABEL] [SPACE] [LABEL] [SPACE] [LABEL] (for labels.txt).'
      """
      if not os.path.exists(file_path):
          raise ValueError(f"{file_path} not found")
  
      os.makedirs(output_dir, exist_ok=True)
  
      base_name = os.path.basename(file_path)
      labels_file = os.path.join(output_dir, "labels_" + base_name)
      text_file = os.path.join(output_dir, "text_" + base_name)
  
      with open(file_path, "r") as f:
          with open(text_file, "w") as text_f:
              with open(labels_file, "w") as labels_f:
                  for line in f:
                      line = line.split()
                      text = ""
                      labels = ""
                      for word in line:
                          label = (
                              word[-1]
                              if word[-1] in punct_marks
                              else "O"
                          )
                          word = remove_punctuation(word)
                          if len(word) > 0:
                              if word[0].isupper():
                                  label += "U"
                              else:
                                  label += "O"
  
                              word = word.lower()
                              text += word + " "
                              labels += label + " "
  
                      text_f.write(text.strip() + "\n")
                      labels_f.write(labels.strip() + "\n")
  
      print(f"{text_file} and {labels_file} created from {file_path}.")
  
file_path: NeMo/nemo/collections/nlp/data/token_classification/token_classification_utils.py
imports: import os
  import pickle
  import re
  import string
  from typing import Dict
  from nemo.collections.nlp.data.data_utils.data_preprocessing import fill_class_weights, get_freq_weights, get_label_stats
  from nemo.utils import logging
label_desc: Use image node_id 2 for calling a global function with example usage: create_text_and_labels(output_dir, file_path, punct_marks) without return types