improve the method to split text into words