def saveResult(self):
        APIcsUnit.saveResult(self) #if result is None, throw Exception
        resultPath = os.path.join(self.resDir, self.fileName)

        fd = open(resultPath+'.'+self.symbol, 'w')

        resultAPI = [self.fileName]

        for key in self.result.keys():
            resultAPI.append('%s:%d' % (key, self.result[key]))

        fd.write(' '.join(resultAPI))

        fd.close()
    def saveResult(self):
        APIcsUnit.saveResult(self)  #if result is None, throw Exception
        resultPath = os.path.join(self.resDir, self.fileName)

        fd = open(resultPath + '.' + self.symbol, 'w')

        resultAPI = [self.fileName]
        self.result = self.result.reshape(1, -1)

        for key in range(self.result.shape[0]):
            resultAPI.append('%s:%d' % (key + 1, self.result[key]))

        fd.write(' '.join(resultAPI))

        fd.close()
Ejemplo n.º 3
0
    def saveResult(self):
        APIcsUnit.saveResult(self)  #if result is None, throw Exception
        resultPath = os.path.join(self.resDir, self.fileName)

        res = self.result
        res = res.reshape(1, -1).flatten()

        fd = open(resultPath + '.' + self.symbol, 'w')
        resContents = [self.fileName]

        for i in range(len(res)):
            if res[i] == 0:
                continue

            resContents.append('%d:%d' % (i + 1, res[i]))

        fd.write(' '.join(resContents))
        fd.close()