The function applies a rule that assigns each word to a category or label based on the word's meaning or context.
