Ask HN: How to easily check if two words are too close
I have a comments section for my web site. But I didn't setup a signup or email validation for posting comments.
Now the issue is, when people ask questions I would like to answer as the site admin, but what if someone else also posts a comment using my username?
The strategy I'm thinking:
If someone tries to post with the site admin username, the code rejects it saying that the username is reserved. Site admin would add a comment using a username which is actually a password. The code checks the username, and if matches this password, then it uses a standard site admin name for the comment.
But it may be difficlut to check for slight variations of the admin username. Is there any library which can test if some word or phrase is too close to a given word? You're looking for Levenshtein distance [1] or a similar string distance algorithm. Yes. I'm actually looking for simpler implementations for use at https://worktheme.com aha - got another idea. I'll just use a different format to display the admin comments. So the imposter can't mimic the format, though they can use the same username. This is frequently done on (pseudonymous) imageboards, as well as chatrooms and the like. The admins have a password/key that when provided, enables them to be displayed differently, like an additional image tag, or a separate nearby text element saying [ADMIN]. This is coded into the server-side site code, and normal users are not able to inject content into that other element to masquerade as admin. The search keyword is "Fuzzy string matching".