simpler term_frequency function for python (https://github.com/matthiaskramm/mrscake/pull/5#commitcomment-8654208)