import re, collections
// This is Peter Norvig's 21 line spelling corrector
// norvig.com/spell-correct.html
def words(text): return re.findall('[a-z]+', text.lower())
def train(features):
model = collections.defaultdict(lambda: 1)
for f in features:
model[f] += 1
return model
NWORDS = train(words(file('big.txt').read()))
alphabet = 'abcdefghijklmnopqrstuvwxyz'
def edits1(word):
splits = [(word[:i], word[i:]) for i in range(len(word) + 1)]
deletes = [a + b[1:] for a, b in splits if b]
transposes = [a + b[1] + b[0] + b[2:] for a, b in splits if len(b)>1]
replaces = [a + c + b[1:] for a, b in splits for c in alphabet if b]
inserts = [a + c + b for a, b in splits for c in alphabet]
return set(deletes + transposes + replaces + inserts)
def known_edits2(word):
return set(e2 for e1 in edits1(word) for e2 in edits1(e1) if e2 in NWORDS)
def known(words): return set(w for w in words if w in NWORDS)
def correct(word):
candidates = known([word]) or known(edits1(word)) or known_edits2(word) or [word]
return max(candidates, key=NWORDS.get)
import re
def words(text): return re.findall("[a-z]+", text)
Morpheus: I know *exactly* what you mean. Let me tell you why you're here. You're here because you know something. What you know you can't explain, but you feel it. You've felt it your entire life, that there's something wrong with the world. You don't know what it is, but it's there, like a splinter in your mind, driving you mad. It is this feeling that has brought you to me. Do you know what I'm talking about?
Neo: The Matrix.
I know what you're thinking, 'cause right now I'm thinking the same thing. Actually, I've been thinking it ever since I got here: Why oh why didn't I take the BLUE pill?
I know you're out there. I can feel you now. I know that you're afraid... you're afraid of us. You're afraid of change. I don't know the future. I didn't come here to tell you how this is going to end. I came here to tell you how it's going to begin. I'm going to hang up this phone, and then I'm going to show these people what you don't want them to see. I'm going to show them a world without you. A world without rules and controls, without borders or boundaries. A world where anything is possible. Where we go from there is a choice I leave to you.
Neo: I know kung fu.
Morpheus: [eyeing him, hand on chin] Show me.
What is "real"? How do you define "real"? If real is what you can feel, smell, taste and see, then 'real' is simply electrical signals interpreted by your brain.
"Typing is no substitute for thinking." Dartmouth Basic manual, 1964.
"The cheapest, fastest, and most reliable components are those that aren’t there." Gordon Bell
"One of my most productive days was throwing away 1000 lines of code." Ken Thompson
"The most effective debugging tool is still careful thought, coupled with judiciously placed print statements." Brian W. Kernighan
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan
"OOP is to writing a program, what going through airport security is to flying." Richard Mansfield
"I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships." Linus Torvalds
"It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter." Nathaniel Borenstein
"Applications programming is a race between software engineer, who strive to produce idiot-proof programs, and the universe which strives to produce bigger idiots. So far the Universe is winning." Rick Cook
"To me programming is more than an important practical art. It is also a gigantic undertaking in the foundations of knowledge." Grace Hopper
"Programming: when the ideas turn into the real things." Maciej Kaczmarek
"Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves." Alan Kay
"Premature optimization is the root of all evil." Don Knuth
"Software and cathedrals are much the same – first we build them, then we pray." Sam Redwine
"Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25." Andrew Rutherford
"One day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" Larry Wall
Zawinski's Law: Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.
"Testing can only prove the presence of bugs, not their absence." Edsger W. Dijkstra
Any release date that includes more than one potential month isn’t going to be hit.
"Being a nobody in a place where everybody thinks they can be a somebody is infectious... is exciting... i want that... for me." Freddie Lyon
"It is a riddle, wrapped in a mystery, inside an enigma." Winston Churchill
Steve Jobs on computers: "They are a bycicle for the mind..."
H.G. Wells on education: "Civilization is a race between education and catastrophe..."
Had I the heavens’ embroidered cloths,
Enwrought with golden and silver light,
The blue and the dim and the dark cloths
Of night and light and the half light,
I would spread the cloths under your feet:
But I, being poor, have only my dreams;
I have spread my dreams under your feet;
Tread softly because you tread on my dreams.
"I don't like puzzles
it's an oportunity for the clever to feel clever
and for the stupid to feel stupid." Rina
"Children begin by loving their parents; as they grow older they judge them; sometimes, they forgive them" Oscar Wilde
Stephen Hawking on fate: "It's amazing that people believe everything is predestined but they still look both ways when crossing the road."
"You know you're in love when you can't fall asleep because reality is finally better than your dreams." Dr. Seuss
Mark Twain on education: "I never let my schooling get in the way of my education."
Questions only lead to answers... what's the fun in that?
"Nothing in the universe is static
everything is moving forward
it can't help it
any ideology that sort of says
we are at the end of discovery about this thing
i always go... well there is absolute no evidence to suggest that's true
We are always in essence at the beginning of infinity...
no matter what we are talking about
there is always one iteration, there always will be
that's the fun of it." Steven Soderbergh
"Never forget what you are. The rest of the world will not. Wear it like armor, and it can never be used to hurt you." Tyrion Lannister
"Unless someone like you
cares a whole awful lot,
nothing is going to get better.
it's not." Dr. Seuss
"Sometimes bad things fall apart so better things can fall together" Marilyn Monroe
"The best way to predict the future is to invent it." Alan Kay
"I know so much that i don't know where to begin..." James Stevenson
"To his dog, every man is King; hence the constant popularity of dogs." Aldous Huxley
Oh, the places you'll go! There is fun to be done! There are points to be scored. There are games to be won. And the magical things you can do with that ball will make you the winningest winner of all. Fame! You'll be famous as famous can be, with the whole wide world watching you win on TV.
Except when they don't. Because, sometimes, they won't. I'm afraid that some times you'll play lonely games too. Games you can't win 'cause you'll play against you.
"If you torture the data long enough, it will confess to anything."
Voltaire on perfectionism: "the best is the worst enemy of the good..."
Hemingway on bankrupcy:
Eric Hellman traced it back to Hemingway's The Sun Also Rises. The full quote:
"How did you go bankrupt?"
"Two ways. Gradually, then suddenly."
Piet Hein on decissions:
Whenever you're called on to make up your mind,
and you're hampered by not having any,
the best way to solve the dilemma, you'll find,
is simply by spinning a penny.
No -- not so that chance shall decide the affair
while you're passively standing there moping;
but the moment the penny is up in the air,
you suddenly know what you're hoping.
Stephen Covey on decissions:
If you want to fill a bucket... put big rocks first... the small ones will fill in the gaps...
If you put the small ones first... there won't we room for the big ones at the end...
It means... you should do the important things first... the big things...
Plato on kindness: "Be kind, for everyone you meet is fighting a hard battle."
there is only a way to get birth but a million ways to die...
Marcos Aurelius on heaven and god:
"Live a good life. If there are gods and they are just, then they will not care how devout you have been, but will welcome you based on the virtues you have lived by. If there are gods, but unjust, then you should not want to worship them. If there are no gods, then you will be gone, but will have lived a noble life that will live on in the memories of your loved ones."
"That adults are not all they're cracked up to be. And most of them are wrong most of the time. This can be quite revelatory for a kid - often launching them on a personal quest of exploration, rather than of Q and A sessions with their parents." Neil Degrasse Tyson
"The problem, often not discovered until late in life, is that when you look for things in life like love, meaning, motivation, it implies they are sitting behind a tree or under a rock. The most successful people in life recognize, that in life they create their own love, they manufacture their own meaning, they generate their own motivation.
For me, I am driven by two main philosophies, know more today about the world than I knew yesterday. And lessen the suffering of others. You'd be surprised how far that gets you.
" Neil Degrasse Tyson
Hal Abelson on computer science:
"As opose to other kinds of engineering where the constraints of what you can build are the constraints of a physical systems... the constraints impose in building large software systems are the limitation of our own mind..."
Epiphany is not the same as absolution... your punishment stands.
the things that scare us
are the things that keep us human
don't ever be afraid of being scared
just don't allow being scared
to dictate the choices you make
"Anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that 'my ignorance is just as good as your knowledge." Isaac Asimov
Koi No Yokan (Japanese) is the sense upon first meeting a person that the two of you are going to fall into love.
Hitchen's Razor: What can be asserted without evidence
can be dismissed without evidence.
"Having kids is a way of achieving something without having any talent at all..." Mitchell and Webb
"In the end, a vision without the ability to execute it is probably an hallucination." Steve Case
"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." Robert A. Heinlein
"When early explorers first set out west across the atlantic
most people thought the world was flat
most people thought if you sail far enough west you would drop off a plane
and nothing
these vessels sailing out into the unknown they were not carrying noble man
or aristocrats, artists, merchants...
they were crewed by people living on the edge of live
madman, orphans, ex-convicts, outcasts, like myself
as a fellon, i'm an unlikely candidate for most things, but perhaps not for this, perhaps i'm the most likely...
Persons of Interest on love: "Is finding the persons that connects you to the world..."
One grandfather on love: "I just wanted you to know that at this moment i was thinking more about you than anyone or anything else."
"A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away." – Antoine de Saint-Exupery.
Little black dress on life and dreams:
resignation, independence...
and today, my 10th drama contest entry failed
i probably have many more failures lined up
but 25 is a great age to dream and to challenge ourselves
and right now...
i'm at the center of my life
Camelot on death:
we all have our own ideas of what death might be
for all we know,
death could be the greatest good that could happen to us
Cicero said, "the life of the dead is placed in the memories of the living"
the love we feel in life
keeps people alive beyond their time
"we just grow old... but our baby will grow up..." sick cancer mom from Hello Ghost
Henry Ford on inventions:
I invented nothing new.
I simply assembled the discoveries of other
men behind whom were centuries of work.
Had i worked fifty or ten or even five years
before, i would have failed.
So it is with every new thing,
Progress happens when all the
factors that make for it are ready,
and then it is inevitable.
To teach that a comparatively few
men are responsible for the greatest
forward steps of mankind is the
worst sort of nonsense.
Iniesta on happiness:
nada es mas gratificante en esta vida que hacer feliz a alguien...
Dying Eko from Lost
I didn't ask for the life i was given...
but it was given nonetheless...
and with it, i did my best.