File size: 1,041 Bytes
f330b5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from typing import Literal

SceneType = Literal["relax", "reading", "movie", "work", "night", "auto"]

def recommend_light_scene(context: str) -> SceneType:
    """Recommend a simple light scene type from a Vietnamese context string."""
    t = context.lower()

    if any(word in t for word in ["xem phim", "phim", "movie"]):
        return "movie"
    if any(word in t for word in ["đọc sách", "reading", "sách"]):
        return "reading"
    if any(word in t for word in ["làm việc", "laptop", "bàn làm việc", "work"]):
        return "work"
    if any(word in t for word in ["thư giãn", "relax"]):
        return "relax"
    if any(word in t for word in ["ngủ", "đi ngủ", "night", "khuya"]):
        return "night"

    return "auto"

if __name__ == "__main__":
    tests = [
        "Bật đèn để xem phim tối nay",
        "Cho ánh sáng phù hợp để đọc sách",
        "Tôi chuẩn bị làm việc ở bàn làm việc",
    ]
    for t in tests:
        print(t, "->", recommend_light_scene(t))