Initial transplant of code from The BFG

https://github.com/rtyley/bfg-repo-cleaner/tree/446b220dbcfbfe447463634c822f719dd6777d65/textmatching