Problem 4: Compute Term Frequency