chatMimic.py
def trainOnVOD(self,
                   vodID,
                   bufferFile="temp.txt",
                   saveOutWeights=True,
                   weightsOutputFile="vodWeights.hdf5",
                   numEpochs=10):
        """Trains text generator on given VOD ID"""
        print("Scraping VOD for chat history")
        # Get all chat from VOD and put it in a buffer file
        fileObj = open(bufferFile, "w")

        for comment in self.helix.video(vodID).comments:
            text = self._deEmojify(comment.message.body)
            fileObj.write(text + "\n")

        fileObj.close()

        print("Beginning training on VOD Chat")
        # Train text generator on said file
        self.vodGen = textgenrnn()
        self.vodGen.train_from_file(bufferFile, num_epochs=numEpochs)
        # Save out weights if enabled
        if(saveOutWeights):
            print("Saving out weights to {}".format(weightsOutputFile))
            self.vodGen.save(weightsOutputFile)
Trains text generator on given VOD ID
Trains text generator on given VOD ID
Trains text generator on given VOD ID
def trainOnVOD(self,
                   vodID,
                   bufferFile="temp.txt",
                   saveOutWeights=True,
                   weightsOutputFile="vodWeights.hdf5",
                   numEpochs=10):
        print("Scraping VOD for chat history")
        fileObj = open(bufferFile, "w")
        for comment in self.helix.video(vodID).comments:
            text = self._deEmojify(comment.message.body)
            fileObj.write(text + "\n")
        fileObj.close()
        print("Beginning training on VOD Chat")
        self.vodGen = textgenrnn()
        self.vodGen.train_from_file(bufferFile, num_epochs=numEpochs)
        if(saveOutWeights):
            print("Saving out weights to {}".format(weightsOutputFile))
            self.vodGen.save(weightsOutputFile)
def trainOnVOD ( self , vodID , bufferFile = "temp.txt" , saveOutWeights = True , weightsOutputFile = "vodWeights.hdf5" , numEpochs = 10 ) : print ( "Scraping VOD for chat history" ) fileObj = open ( bufferFile , "w" ) for comment in self . helix . video ( vodID ) . comments : text = self . _deEmojify ( comment . message . body ) fileObj . write ( text + "\n" ) fileObj . close ( ) print ( "Beginning training on VOD Chat" ) self . vodGen = textgenrnn ( ) self . vodGen . train_from_file ( bufferFile , num_epochs = numEpochs ) if ( saveOutWeights ) : print ( "Saving out weights to {}" . format ( weightsOutputFile ) ) self . vodGen . save ( weightsOutputFile )
Trains text generator on given VOD ID
Trains text generator on given VOD ID
"""Trains text generator on given VOD ID""" # Get all chat from VOD and put it in a buffer file # Train text generator on said file # Save out weights if enabled
self
vodID
bufferFile
saveOutWeights
weightsOutputFile
numEpochs