Advertisement
meta1211

Untitled

Apr 20th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1.     def IsInVocablary(self, word):
  2.         return 1 if word in self.vectorizer.vocabulary_ else 0
  3.    
  4.     def GetObjectivity(self, text):
  5.         if(len(text) == 0):
  6.             return 1.0
  7.         return sum([self.IsInVocablary(word) for word in text.split()])/float(len(text.split()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement