dtw function for a more precise cost between word(probably won't be used)