News for hackers. Stuff that matters.
Re:How to Write a Spelling Corrector by drc0 on Thursday September 08, 2016 @01:27PM (#12455068)
I agree, you could learn so much just looking at how he defines functions.. see this for example:

    def pdist(counter):
        "Make a probability distribution, given evidence from a Counter."
        N = sum(counter.values())
        return lambda x: counter[x]/N

    P = pdist(COUNTS)
from http://nbviewer.jupyter.org/url/norvig.com/ipython/How%20to%...

There are no comments on this comment yet.