Earlier quoted context omitted.
What is the application where typos in a document are acceptable?
Classified reports. This technique is called the Canary Trap, with the name (but not the technique) coined by Tom Clancy. https://en.wikipedia.org/wiki/Canary_trap
How to Write a Spelling Corrector
71–80 of 133 posts
Re: How to Write a Spelling Corrector
#72I couldn't help but read this and think about all the "coding" initiatives I've seen in K-12 and shake my head. What Norvig is doing is what we should be teaching. He is tackling this seemingly REALLY hard problem by thinking about it methodically, translating some intuition into code, carefully constructing an argument about how to solve it, and ways that it could be extended. This is what actual engineers look like…
By that reasoning, we should not teach kids how to spell, or about punctuation, and just aim for them writing essays/stories/novels.
Re: How to Write a Spelling Corrector
#73Earlier quoted context omitted.
You can also use the set-comprehension syntax, which functions equivalently but looks slightly nicer: return {w for w in words if w in WORDS} could have also directly used the intersection operator on the sets: return words & WORDS or slightly more verbose, but maybe more clear for colleagues who don't regularly use sets in Python: return words.intersection(WORDS)
> return words & WORDS Not quite. It'd have to be set(WORDS) instead of WORDS -- which'd be expensive. Or WORDS.keys(), which I'm not sure about -- I'd have to benchmark it.
Re: How to Write a Spelling Corrector
#74Earlier quoted context omitted.
What is wrong with his docstrings?
Nothing's wrong with them. Though it is more usual to use triple quotes for docstrings even if they fit on one line (see PEP 257, "Triple quotes are used even though the string fits on one line. This makes it easy to later expand it.").
Re: How to Write a Spelling Corrector
#75Re: How to Write a Spelling Corrector
#76Spell chequer Martha Snow Eye halve a spelling chequer It came with my pea sea It plainly marques four my revue Miss steaks eye kin knot sea. Eye strike a quay and type a word And weight four it two say Weather eye am wrong oar write It shows me strait a weigh. As soon as a mist ache is maid It nose bee fore two long And eye can put the error rite It's rare lea ever wrong. Eye have run this poem threw it I am shore y…
Re: How to Write a Spelling Corrector
#77Re: How to Write a Spelling Corrector
#78Earlier quoted context omitted.
Classified reports. This technique is called the Canary Trap, with the name (but not the technique) coined by Tom Clancy. https://en.wikipedia.org/wiki/Canary_trap
For that purpose you'd want to add typos that would be "corrected" into the wrong word by a typical spellchecker or that are actually correct, but atypical in context, words. Otherwise passing the document through a spellchecker would remove the watermark.
Re: How to Write a Spelling Corrector
#79Earlier quoted context omitted.
You can also use the set-comprehension syntax, which functions equivalently but looks slightly nicer: return {w for w in words if w in WORDS} could have also directly used the intersection operator on the sets: return words & WORDS or slightly more verbose, but maybe more clear for colleagues who don't regularly use sets in Python: return words.intersection(WORDS)
> return words & WORDS Not quite. It'd have to be set(WORDS) instead of WORDS -- which'd be expensive. Or WORDS.keys(), which I'm not sure about -- I'd have to benchmark it.
Re: How to Write a Spelling Corrector
#80Earlier quoted context omitted.
You can also use the set-comprehension syntax, which functions equivalently but looks slightly nicer: return {w for w in words if w in WORDS} could have also directly used the intersection operator on the sets: return words & WORDS or slightly more verbose, but maybe more clear for colleagues who don't regularly use sets in Python: return words.intersection(WORDS)
> return words & WORDS Not quite. It'd have to be set(WORDS) instead of WORDS -- which'd be expensive. Or WORDS.keys(), which I'm not sure about -- I'd have to benchmark it.