I think in general there is a readability problem. I feel that the code should resemble as closely as the math formula (line breaks would kind of ruin that, imo, though others may think otherwise).

The current `tf` and `idf` function is not very resembling.. so I think I need to work on that. 

I'm a little bit concerned that change the function `f` to `frequency` might blow over the line limit. Though I'll let others weigh in their opinions.