

Given a string text, write a function that returns a dictionary mapping each word to its frequency. Treat words case-insensitively, ignore punctuation, and split on any non-alphanumeric character. Return the result as a standard Python dictionary where keys are normalized lowercase words and values are counts.
Example 1:
Input: text = "Data, data! Science? data."
Output: {"data": 3, "science": 1}
Explanation: Punctuation is ignored and all words are converted to lowercase.
Example 2:
Input: text = "model_1 model-1 MODEL"
Output: {"model": 1, "1": 2, "model_1": 1}
Explanation: Splitting happens on non-alphanumeric characters, so `model-1` becomes `model` and `1`, while `model_1` stays intact because `_` is preserved.
0 <= len(text) <= 10^5text contains ASCII letters, digits, spaces, punctuation, and underscoresGiven a string text, write a function that returns a dictionary mapping each word to its frequency. Treat words case-insensitively, ignore punctuation, and split on any non-alphanumeric character. Return the result as a standard Python dictionary where keys are normalized lowercase words and values are counts.
Example 1:
Input: text = "Data, data! Science? data."
Output: {"data": 3, "science": 1}
Explanation: Punctuation is ignored and all words are converted to lowercase.
Example 2:
Input: text = "model_1 model-1 MODEL"
Output: {"model": 1, "1": 2, "model_1": 1}
Explanation: Splitting happens on non-alphanumeric characters, so `model-1` becomes `model` and `1`, while `model_1` stays intact because `_` is preserved.
0 <= len(text) <= 10^5text contains ASCII letters, digits, spaces, punctuation, and underscores