Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def IsInVocablary(self, word):
- return 1 if word in self.vectorizer.vocabulary_ else 0
- def GetObjectivity(self, text):
- if(len(text) == 0):
- return 1.0
- return sum([self.IsInVocablary(word) for word in text.split()])/float(len(text.split()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement