Files
miku-discord/tests/test_pfp_context.py

79 lines
2.7 KiB
Python
Raw Permalink Normal View History

#!/usr/bin/env python3
"""
Test profile picture context plugin
"""
import re
# Test patterns
PFP_PATTERNS = [
# Direct PFP references
r'\b(what|describe|tell me about|explain|show|how)\b.*\b(pfp|profile pic|avatar|picture|pic)\b',
r'\b(your|miku\'?s?)\b.*\b(pfp|profile pic|avatar|picture|pic)\b',
r'\b(pfp|profile pic|avatar|picture|pic)\b.*\b(is|look|show|about|like)',
# Questions about appearance
r'\b(what|how).*\b(you|miku)\b.*(look|looking|appear)',
r'\byour (new )?look\b',
r'\b(what|how).*looking like\b',
# Questions about the image itself
r'\b(think|feel|opinion|thoughts)\b.*\b(about|of)\b.*\b(your|that|the|this)?\b.*\b(pfp|profile|avatar|pic|picture|image)\b',
r'\b(why|how|when).*\b(pick|choose|chose|picked|select|change|changed)\b.*\b(pfp|profile|avatar|pic|picture|that)\b',
r'\b(new|current|latest)\b.*\b(pfp|profile pic|avatar|pic|picture)\b',
# "What do you think about your pfp"
r'\bthink.*\b(your|that|the|this)\b.*\b(pfp|profile|avatar|pic|picture)\b',
r'\b(your|that|the|this)\b.*\b(pfp|profile|avatar|pic|picture)\b.*\bthink\b',
# "How did you decide/pick"
r'\b(decide|decided|pick|picked|choose|chose|select)\b.*\b(pfp|profile|avatar|pic|picture|that|this)\b',
# "Tell me about that pfp" / "What's with the pfp"
r'\bwhat\'?s?\b.*\bwith\b.*\b(pfp|profile|avatar|pic|picture)\b',
r'\btell me\b.*\b(pfp|profile|avatar|pic|picture|that|this)\b',
]
test_queries = [
# Original tests
"What does your pfp look like?",
"Describe your profile picture",
"Tell me about your avatar",
"What's your profile pic?",
"How do you look today?",
"Your new look is cool",
"What are you looking like?",
"Show me your picture",
# User's examples
"How did you decide to pick that pfp?",
"What do you think about your new profile pic?",
"What do you think about your pfp, Miku?",
"How did you choose that avatar?",
"Why did you pick that pfp?",
"When did you change your profile pic?",
"Tell me about that pfp",
"What's with the pfp?",
"Your current pfp is nice",
"How did you decide on that picture?",
# Should NOT match
"What's the weather like?",
"Hello Miku!",
"How are you feeling?",
"What do you think about music?",
]
def matches_pfp_query(text: str) -> bool:
"""Check if the message is asking about the profile picture"""
text_lower = text.lower()
for pattern in PFP_PATTERNS:
if re.search(pattern, text_lower, re.IGNORECASE):
return True
return False
print("Testing PFP pattern matching:\n")
for query in test_queries:
result = matches_pfp_query(query)
status = "✓ MATCH" if result else "✗ NO MATCH"
print(f"{status}: {query}")