-
-
Save BernardOng/26cd0d0e3d8509c47bb26c78c8dabfa9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add(self, title, rating): | |
newsent = self.cleanTokens(title) | |
for x in range(len(newsent)): | |
if newsent[x] not in self.corpus: | |
self.corpus[newsent[x]] = [0,0,0,0,0] | |
if rating > 0.00 and rating <= 1.44: self.corpus[newsent[x]][0] += 1 | |
if rating > 1.44 and rating <= 2.44: self.corpus[newsent[x]][1] += 1 | |
if rating > 2.44 and rating <= 3.44: self.corpus[newsent[x]][2] += 1 | |
if rating > 3.44 and rating <= 4.44: self.corpus[newsent[x]][3] += 1 | |
if rating > 4.44 and rating <= 5.00: self.corpus[newsent[x]][4] += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment