Key phrase extraction algorithm