WIP
refactoring of caluclating tf idf