def anonymize_msg_list(msg_list): """Anonymize a list of text bodies. """ for i in range(len(msg_list)): for orig, hmhashed in names.iteritems(): msg_list[i] = msg_list[i].replace(orig, hmhashed) return msg_list
def get_mentions_msg_list(msg_list): mentions = [] for msg in msg_list: for orig, hmhashed in names.iteritems(): if hmhashed in msg: mentions.append(hmhashed) return mentions
def get_mentions(msg): mentions = [] for orig, hmhashed in names.iteritems(): if hmhashed in msg: mentions.append(hmhashed) return mentions
def anonymize(msg): """Anonymize a single text body. """ for orig, hmhashed in names.iteritems(): msg = msg.replace(orig, hmhashed) return msg