News for hackers. Stuff that matters.
Re:Ask HN: So, I need regular expressions... by seanccox on Monday May 27, 2013 @08:17AM (#5774364)
That's very helpful. Since I am just starting out, I often find myself trying to use the wrong tool for a job, because I simply don't know what the hell I'm doing. I can use a dictionary as you describe to correct the spelling issues, then I suppose regex can be used on certain formatting problems (if need be)?

Since I am just getting started, can you tell me how I would go about building such a dictionary? For instance, should I create a text file with the word pairs (American, British), or two different files for each?

Thanks for the direction, and apologies if these questions seem foolish. As I indicated, I made something that works, but is slow and buggy. Getting direction on how to move forward really is a big help. Cheers.

Re:Ask HN: So, I need regular expressions... by Piskvorrr on Monday May 27, 2013 @08:29AM (#5774401)
Probably keep the pairs together. Not sure what Applescript uses for hashmaps, but you probably want to load your dictionary into a hashmap or something like that, and lookup in that (much faster than on-disk access).