Document similarity comparison in Python