class_docstr: This class defines methods for loading and iterating over text datasets.
class_docstr_tok: ["This","class","defines","methods","for","loading","and","iterating","over","text","datasets","."]
docstr: Create separate files for training and validation.
  
  Arguments:
      path(str): Path to data file.
      valid_split(float, optional): Fraction of data to set aside for validation.
  
  Returns:
      str, str : Paths to train file and validation file
docstr_tok: ["Create","separate","files","for","training","and","validation",".","Arguments",":","path","(","str",")",":","Path","to","data","file",".","valid_split","(","float",",","optional",")",":","Fraction","of","data","to","set","aside","for","validation",".","Returns",":","str",",","str",":","Paths","to","train","file","and","validation","file"]
code: def create_valid_file(path, valid_split=0.1):
      """
      Create separate files for training and validation.
  
      Arguments:
          path(str): Path to data file.
          valid_split(float, optional): Fraction of data to set aside for validation.
  
      Returns:
          str, str : Paths to train file and validation file
      """
      text = open(path).read()
  
      # create train and valid paths
      filename, ext = os.path.splitext(path)
      train_path = filename + "_train" + ext
      valid_path = filename + "_valid" + ext
  
      # split data
      train_split = int(len(text) * (1 - valid_split))
      train_text = text[:train_split]
      valid_text = text[train_split:]
  
      # write train file
      with open(train_path, "w") as train_file:
          train_file.write(train_text)
  
      # write valid file
      with open(valid_path, "w") as valid_file:
          valid_file.write(valid_text)
  
      return train_path, valid_path
  
imports: import logging
  import numpy
  import os
  import h5py
  from neon.data.dataiterator import NervanaDataIterator, ArrayIterator
  from neon.data.datasets import Dataset
  from neon.data.text_preprocessing import pad_sentences, pad_data
label_desc: Use image node_id 3 for calling the Text obj's underlying member method code with example usage: obj.create_valid_file(path, valid_split) and returns: train_path,  valid_path