| 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)) | |