Ngrams calculation and DB loading (draft, to be improved yet).