I imported a text and seperated al words by using StringCases
. After this I would like to manipulate the text, for example to replace all singular verbs to plural. When I use StringReplace
, then Mathematica search for a part of the string and replaced it.
For example
texttest = "walking walk routes walks"
texttest1 = StringCases[texttest, RegularExpression["\\w(?<!\\d)[\\w'-]*"]];
newwords= {"walk" -> "walking", "walks" -> "walking"};
texttest2 = StringReplace[texttest1, newwords];
The result is:
{"walkinging", "walking", "routes", "walkings"}
I would like to get: {"walking", "walking", "routes", "walking"}
.