File size: 512 Bytes
88fe4e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import re

def detect_intent(text: str) -> str:
    """Map natural language to a vision task token."""
    text = text.lower().strip()
    
    if re.search(r"read|sign|text|document|label|menu", text):
        return "<OCR>"
    elif re.search(r"where|object|nearby|around me|front of me", text):
        return "<OD>"
    elif re.search(r"detail|describe.*room", text):
        return "<MORE_DETAILED_CAPTION>"
    else:
        # Default to standard caption
        return "<DETAILED_CAPTION>"