def categorize_content(file_path): # Extract tags from filename filename = os.path.basename(file_path) tags = re.findall(r'\.(.+?)\.', filename) # Define categories and tags categories = { 'mature': ['mature', 'adult'], 'person': ['person', 'woman', 'man'] } # Categorize content categorized_tags = [] for tag in tags: for category, keywords in categories.items(): if tag.lower() in keywords: categorized_tags.append((category, tag)) return categorized_tags
import os import re
"Content Categorization and Tagging"