Can you write a word count program in PySpark?
Asked in the technical interview stage. Implement the core word-count transformation as a single Python function using standard-library behavior so it can be graded without a Spark installation.
lines is a list of strings. Return a dictionary mapping each lowercase alphanumeric word to its frequency. Extract words with the pattern [A-Za-z0-9]+; punctuation separates words.
def word_count(lines):