def __init__(self, time_steps, path, vocab=None, tokenizer=None,
                 onehot_input=True):
        """
        Construct a text dataset object.

        Args:
            time_steps (int) : Length of a sequence.
            path (str) : Path to text file.
            vocab (python.set) : A set of unique tokens.
            tokenizer (object) : Tokenizer object.
            onehot_input (boolean): One-hot representation of input
        """
        super(Text, self).__init__(name=None)
        # figure out how to remove seq_length from the dataloader
        self.seq_length = time_steps
        self.onehot_input = onehot_input
        self.batch_index = 0

        text = open(path).read()
        tokens = self.get_tokens(text, tokenizer)

        # make this a static method
        extra_tokens = (self.be.bsz * time_steps) % len(tokens)
        if extra_tokens:
            tokens = tokens[:-extra_tokens]
        self.nbatches = len(tokens) / (self.be.bsz * time_steps)
        self.ndata = self.nbatches * self.be.bsz  # no leftovers

        self.vocab = sorted(self.get_vocab(tokens, vocab))
        self.nclass = len(self.vocab)

        # vocab dicts
        self.token_to_index = dict((t, i) for i, t in enumerate(self.vocab))
        self.index_to_token = dict((i, t) for i, t in enumerate(self.vocab))

        # map tokens to indices
        X = np.asarray([self.token_to_index[t] for t in tokens], dtype=np.uint32)
        y = np.concatenate((X[1:], X[:1]))

        # reshape to preserve sentence continuity across batches
        self.X = X.reshape(self.be.bsz, self.nbatches, time_steps)
        self.y = y.reshape(self.be.bsz, self.nbatches, time_steps)

        # stuff below this comment needs to be cleaned up and commented
        self.nout = len(self.vocab)
        if self.onehot_input:
            self.shape = (self.nout, time_steps)
            self.dev_X = self.be.iobuf((self.nout, time_steps))
        else:
            self.shape = (time_steps, 1)
            self.dev_X = self.be.iobuf(time_steps, dtype=np.int32)

        self.dev_y = self.be.iobuf((self.nout, time_steps))
        self.dev_lbl = self.be.iobuf(time_steps, dtype=np.int32)
        self.dev_lblflat = self.dev_lbl.reshape((1, -1))
dataset/ETHPy150Open NervanaSystems/neon/neon/data/text.py/Text.__init__/swapped operands of `%`