I have a bit of code that works well in calculating term frequency using the counter class import.
from collections import Counter terms=['the', 'fox', 'the', 'quick', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'] tf = Counter(terms) print(tf)I am wondering can this be done without the use of the counter class in a simple def.