def test100_003_score_multiattr(self): attr1 = Attribute("1", 1, ["burgers"], [1], [0]) attr2 = Attribute("2", 1, ["fries"], [2], [0]) attr3 = Attribute("3", 1, ["tacos"], [3], [0]) packet = SearchPacket([attr1, attr2, attr3]) score = Scorer(packet) text = "I hate tacos and love fries and burgers are okay." self.assertEquals(score.score(text), [1, 2, 3, 0, 0])
def test100_002_score_mixed(self): weights = [1, 3, 2, 2] sentiments = [0, 0, 0, 0] attribute = Attribute("Attribute1", 1, self.words, weights, sentiments) packet = SearchPacket([attribute]) score = Scorer(packet) text = "I hate tacos and love fries." #tacos has weight 3, fries 2 self.assertEquals(score.score(text), [5, 0, 0, 0, 0])
depthScreenshots = [] for generatedChair in progressbar(newChairs, "Making Screenshots"): perspectives = mps.captureDepth(generatedChair, rotations, imageWidth=224, imageHeight=224) depthScreenshots.append((generatedChair, perspectives)) s = Scorer() # Assign a score scoredChairs = [] for generatedChair, perspectives in progressbar(depthScreenshots, "Evaluating Chairs"): score = s.score(perspectives) generatedChair.cachedScore = score scoredChairs.append((generatedChair, score)) # sort models depending on the score, from bigger to smaller chairsToDisplay = [] sortedChairs = sorted(scoredChairs, reverse=True, key=lambda tup: tup[1]) for chair, value in sortedChairs: print(value) chairsToDisplay.append(chair) # we would need only 10 top chairs chairsToDisplay = chairsToDisplay[:chairsToGenerateCount] # export the chairs as .objs for i in progressbar(range(len(chairsToDisplay)),