Loading...
Classify a text into one of three categories based on keyword matching:
Check categories in the order: sports → tech → food. Return the first matching category. If no keywords match, return "other".
All matching is case-insensitive and checks if the keyword appears as a whole word in the text.
Input: A single line of text.
The team scored a goal
sports
Step 1: Lowercase and split "the team scored a goal" → words: ["the", "team", "scored", "a", "goal"]
Step 2: Check sports keywords "team" matches → return "sports"