Fast calculation of n-gram-based phrase similarity