replacing patterns in text
Im resolving conferencing named entities in text. i want to replace all the entities referring to the same name into one single name. for example i have a list of words like,
which refer to the same person. in my text i want to replace the words, Mr.Kennedy, Kennedy and Winston E.Kennedy with Winston Kennedy . but the problem is when i use regex patterns, the word Kennedy is replaced also in the word Winston Kennedy and returns Winston Winston Kennedy. it also happens in Winston E.Kennedy and returns Winston E.Winston Kennedy.
how can i solve this?