in reply to Efficient selective substitution on list of words

my %words = ( score => { replacement => 'twenty', stopwords => { fourscore => 1, scored => 1, scores => 1, }, }, core => { replacement => 'center', stopwords => { encore => 1, coreagent => 1, }, }, centre => { replacement => 'center', stopwords => { }, }, ... );

If you have the data structure above, you may have enough to construct an efficient logic needed to achieve your task.