Add algorithm for calculating term statistics.