An improved algorithm for semantic clustering