Re: Code Explaination: Spelling correction code

2007-04-12 Thread Drew
On Apr 11, 11:27 pm, Steven Bethard [EMAIL PROTECTED] wrote: Drew wrote: I recently saw this website:http://www.norvig.com/spell-correct.html All the code makes sense to me save one line: def known_edits2(word): return set(e2 for e1 in edits1(word) for e2 in edits1(e1) if e2 in

Re: Code Explaination: Spelling correction code

2007-04-12 Thread Steven Bethard
Drew wrote: On Apr 11, 11:27 pm, Steven Bethard [EMAIL PROTECTED] wrote: Drew wrote: def known_edits2(word): return set(e2 for e1 in edits1(word) for e2 in edits1(e1) if e2 in NWORDS) This is the same as: result = set() for e1 in edits1(word): for e2 in

Re: Code Explaination: Spelling correction code

2007-04-12 Thread Drew
On Apr 12, 10:28 am, Steven Bethard [EMAIL PROTECTED] wrote: Drew wrote: On Apr 11, 11:27 pm, Steven Bethard [EMAIL PROTECTED] wrote: Drew wrote: def known_edits2(word): return set(e2 for e1 in edits1(word) for e2 in edits1(e1) if e2 in NWORDS) This is the same as: result

Code Explaination: Spelling correction code

2007-04-11 Thread Drew
I recently saw this website: http://www.norvig.com/spell-correct.html All the code makes sense to me save one line: def known_edits2(word): return set(e2 for e1 in edits1(word) for e2 in edits1(e1) if e2 in NWORDS) I understand (from seeing a ruby version of the code) that the goal here is

Re: Code Explaination: Spelling correction code

2007-04-11 Thread Steven Bethard
Drew wrote: I recently saw this website: http://www.norvig.com/spell-correct.html All the code makes sense to me save one line: def known_edits2(word): return set(e2 for e1 in edits1(word) for e2 in edits1(e1) if e2 in NWORDS) This is the same as: result = set() for e1 in