Exemple #1
0
    def readFiles(self, instancesFilename):

        print('Reading saved files...', instancesFilename,
              config.questionDictFile(), config.answerDictFile(),
              config.qaDictFile())

        with open(instancesFilename, "r") as inFile:
            instances = json.load(inFile)

        with open(config.questionDictFile(), "rb") as inFile:
            self.questionDict = pickle.load(inFile)

        with open(config.answerDictFile(), "rb") as inFile:
            self.answerDict = pickle.load(inFile)

        with open(config.qaDictFile(), "rb") as inFile:
            self.qaDict = pickle.load(inFile)

        return instances
Exemple #2
0
    def writeFiles(self, instances, instancesFilename):
        with open(instancesFilename, "w") as outFile:
            json.dump(instances, outFile)

        with open(config.questionDictFile(), "wb") as outFile:
            pickle.dump(self.questionDict, outFile)

        with open(config.answerDictFile(), "wb") as outFile:
            pickle.dump(self.answerDict, outFile)

        with open(config.qaDictFile(), "wb") as outFile:
            pickle.dump(self.qaDict, outFile)
Exemple #3
0
    def writeVocabs(self):
        with open(config.questionDictFile(), "wb") as outFile:
            pickle.dump(self.questionDict, outFile)

        with open(config.answerDictFile(), "wb") as outFile:
            pickle.dump(self.answerDict, outFile)

        with open(config.qaDictFile(), "wb") as outFile:
            pickle.dump(self.qaDict, outFile)

        with open(config.sceneDictFile(), "wb") as outFile:
            pickle.dump(self.sceneDict, outFile)
Exemple #4
0
    def readFiles(self, instancesFilename):
        with open(instancesFilename, "r") as inFile:
            instances = json.load(inFile)

        with open(config.questionDictFile(), "rb") as inFile:
            self.questionDict = pickle.load(inFile)

        with open(config.answerDictFile(), "rb") as inFile:
            self.answerDict = pickle.load(inFile)

        with open(config.qaDictFile(), "rb") as inFile:
            self.qaDict = pickle.load(inFile)

        return instances
Exemple #5
0
    def loadVocabs(self):
        if os.path.exists(config.qaDictFile()) and os.path.exists(
                config.sceneDictFile()):
            print("load dictionaries")
            with open(config.questionDictFile(), "rb") as inFile:
                self.questionDict = pickle.load(inFile)

            with open(config.answerDictFile(), "rb") as inFile:
                self.answerDict = pickle.load(inFile)

            with open(config.qaDictFile(), "rb") as inFile:
                self.qaDict = pickle.load(inFile)

            with open(config.sceneDictFile(), "rb") as inFile:
                self.sceneDict = pickle.load(inFile)