def generateStickerRatioReport(self):
     friends = self._getFriends()
     
     print "Generating Sticker Ratio Report............."
     
     for friend in friends:
         stickers = DatabaseUtil.getMessagesByFriend(self.db, friend.ID, DatabaseUtil.STICKERS_ONLY)
         messages = DatabaseUtil.getMessagesByFriend(self.db, friend.ID, DatabaseUtil.STICKERS_ENABLED)
         print "\t", friend.name, ": ", "{0:.2f}".format(100 * float(len(stickers)) / len(messages)), "%"
    def generateStickerRatioReport(self):
        friends = self._getFriends()

        print "Generating Sticker Ratio Report............."

        for friend in friends:
            stickers = DatabaseUtil.getMessagesByFriend(
                self.db, friend.ID, DatabaseUtil.STICKERS_ONLY)
            messages = DatabaseUtil.getMessagesByFriend(
                self.db, friend.ID, DatabaseUtil.STICKERS_ENABLED)
            print "\t", friend.name, ": ", "{0:.2f}".format(
                100 * float(len(stickers)) / len(messages)), "%"
Пример #3
0
 def _getFriends(self):
     if self.friends:
         return self.friends
     
     self.friends = DatabaseUtil.getFriends(self.db)
     return self.friends
     
 def generateStickerReport(self):
     friends = self._getFriends()
     
     print "Generating Sticker Report............."
     
     for friend in friends:
         messages = DatabaseUtil.getMessagesByFriend(self.db, friend.ID, DatabaseUtil.STICKERS_ONLY)
         print "\t", friend.name, ": ", len(messages)
    def generateStickerReport(self):
        friends = self._getFriends()

        print "Generating Sticker Report............."

        for friend in friends:
            messages = DatabaseUtil.getMessagesByFriend(
                self.db, friend.ID, DatabaseUtil.STICKERS_ONLY)
            print "\t", friend.name, ": ", len(messages)
Пример #6
0
    def generateAmazonCountReport(self):
        friends = self._getFriends()

        print "Generating \"Amazon\" Count Report............."

        for friend in friends:
            amazonCount = 0
            messages = DatabaseUtil.getMessagesByFriend(self.db, friend.ID, DatabaseUtil.STICKERS_DISABLED)
            for message in messages:
                #tokenize the message
                tokens = message.text.split()
                amazonCount += sum([1 for token in tokens if WordAnalysis.isAmazon(WordAnalysis.stripPunctuation(token))])
            print "\t", friend.name, ": ", amazonCount
Пример #7
0
    def generateMessageLenReport(self):
        friends = self._getFriends()

        print "Generating Word Average Report............."

        for friend in friends:
            messages = DatabaseUtil.getMessagesByFriend(self.db, friend.ID, DatabaseUtil.STICKERS_DISABLED)

            avg = [len(message.text.split()) for message in messages]

            if len(avg) > 0:
                avg = float(sum(avg)) / len(avg)
                print "\t", friend.name, ": ", "{0:.2f}".format(avg) + " words"
            else:
                print "\t", friend.name, ": No messages"