@staticmethod
    def create_valid_file(path, valid_split=0.1):
        """
        Create separate files for training and validation.

        Args:
            path (str) : Path to data file.
            valid_split (float) : 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 = 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
dataset/ETHPy150Open NervanaSystems/neon/neon/data/text.py/Text.create_valid_file/original