make term statistics and term vectors accessible in scripts

see documentation on how to use it.

closes #3772
add benchmark and some opt