Just wrote this dependency-free JS snippet that will solve this very problem
https://github.com/ajkochanowicz/BuddySystem
Essentially this is the source code
var buddySystem=function(e){var n=[],r=[]
n=e.length?e:n.concat(e),Array.prototype.map.call(n,function(e){var n=String(e.innerHTML)
n=n.replace(/\s+/g," ").replace(/^\s|\s$/g,""),r.push(n?e.innerHTML=n.replace(new RegExp("((?:[^ ]* ){"+((n.match(/\s/g)||0).length-1)+"}[^ ]*) "),"$1 "):void 0)})}
and you can implement it by doing this
objs = document.getElementsByClassName('corrected');
buddySystem(objs);
Now you'll never have a word by itself for any tags with the corrected
class.
You can also use jQuery if you want.
$(".corrected").buddySystem()
Check out the link for all possibilities.