File size: 856 Bytes
0eef561
 
71aeaca
 
 
 
 
 
0eef561
 
71aeaca
0eef561
 
71aeaca
0eef561
 
71aeaca
0eef561
 
71aeaca
0eef561
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import re

def clean_tags(tags):
    # Make tags more human readable
    tags = tags.replace(' ', ', ').replace('_', ' ')

    # Remove "!", "?", ".", "(", ")" from the tags
    tags = re.sub(r"[!.?()]", "", tags)
    
    # Replace " , " with an empty space
    tags = re.sub(r" , ", " ", tags)
    
    # Remove any trailing commas
    tags = re.sub(r"^,|,$", "", tags)
    
    # Strip spaces
    tags = tags.strip()
    
    # Remove any usernames
    words = tags.split(", ")
    result = []
    for word in words:
        word = word.strip()
        if word == 'v':
            result.append(word)
            continue
        if len(word) < 2:
            continue
        if any(char.isdigit() for char in word) and word not in ["1girl", "1boy", "1koma", "1other"]:
            continue
        result.append(word)
    
    return ", ".join(result)