(self, sentences, sentence_text, nsamples, nwords,
                 max_len=100, index_from=2)
Construct a sentence dataset object.
        Build the context using skip-thought model

        Aguments:
            sentences: list of tokenized (and int-encoded) sentences to use for iteration
            sentence_text: list of raw text sentences
            nsamples: number of sentences
            nwords: number of words in vocab
Construct a sentence dataset object.
        Build the context using skip-thought model
Construct a sentence dataset object . Build the context using skip - thought model
def __init__(self, sentences, sentence_text, nsamples, nwords,
                 max_len=100, index_from=2):
        """
        Construct a sentence dataset object.
        Build the context using skip-thought model

        Aguments:
            sentences: list of tokenized (and int-encoded) sentences to use for iteration
            sentence_text: list of raw text sentences
            nsamples: number of sentences
            nwords: number of words in vocab
        """
        super(SentenceEncode, self).__init__(name=None)
        self.nsamples = nsamples
        self.nwords = nwords
        self.batch_index = 0
        self.nbatches = 0
        self.max_len = max_len
        self.index_from = index_from

        # group the sentences to triplets
        source = sentences[:nsamples]
        source_text = sentence_text[:nsamples]
        extra_sent = len(source) % self.be.bsz

        self.nbatches = len(source) // self.be.bsz
        self.ndata = self.nbatches * self.be.bsz  # no leftovers

        if extra_sent:
            source = source[:-extra_sent]
            source_text = source_text[:-extra_sent]

        # get sentence length stats based on the input sentence length
        self.sent_len = dict((i, min(len(c), self.max_len)) for i, c in enumerate(source))

        self.X = source
        self.X_text = source_text

        # inputs using embeddings
        self.dev_X = self.be.iobuf(self.max_len, dtype=np.int32)
        # the np array to put noncontiguous data in. use for entire minibatch
        self.X_np = np.empty((self.max_len, self.be.bsz), dtype=np.int32)

        self.shape = (self.max_len, 1)
def __init__ ( self , sentences , sentence_text , nsamples , nwords , max_len = 100 , index_from = 2 ) : super ( SentenceEncode , self ) . __init__ ( name = None ) self . nsamples = nsamples self . nwords = nwords self . batch_index = 0 self . nbatches = 0 self . max_len = max_len self . index_from = index_from # group the sentences to triplets source = sentences [ : nsamples ] source_text = sentence_text [ : nsamples ] extra_sent = len ( source ) % self . be . bsz self . nbatches = len ( source ) // self . be . bsz self . ndata = self . nbatches * self . be . bsz # no leftovers if extra_sent : source = source [ : - extra_sent ] source_text = source_text [ : - extra_sent ] # get sentence length stats based on the input sentence length self . sent_len = dict ( ( i , min ( len ( c ) , self . max_len ) ) for i , c in enumerate ( source ) ) self . X = source self . X_text = source_text # inputs using embeddings self . dev_X = self . be . iobuf ( self . max_len , dtype = np . int32 ) # the np array to put noncontiguous data in. use for entire minibatch self . X_np = np . empty ( ( self . max_len , self . be . bsz ) , dtype = np . int32 ) self . shape = ( self . max_len , 1 )