<commit_before><commit_msg>A script for deleting orphaned comments in the database.<commit_after>from catalogue.models import Comment, Release

for comment in Comment.objects.all():
    if Release.objects.filter(id=comment.cdid).exists():
        pass
    else:
        print comment.cdid
        comment.delete()

print "Done!"
{'fraction_non_alphanumeric': 0.0975609756097561, 'fraction_numerical': 0.0, 'mean_word_length': 3.7, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2353946', 'n_tokens_mistral': 91, 'n_tokens_neox': 87, 'n_words': 26}