Learning with N-grams : from massive scales to compressed representations