Technical phone screen in Python; assess ability to implement similarity metric.
Implement a Python function that computes the cosine similarity between two strings (treat each string as a bag-of-words vector).
Tokenize, count word frequencies, form vectors, dot product divided by magnitudes; handle empty inputs.