From: Neil Smith Date: Mon, 10 Jul 2017 15:46:55 +0000 (+0100) Subject: Merge branch 'master' of git.njae.me.uk:ou-programming-quiz X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=041a6ab60fde9a9c7c52e0aad9548e434c68f9a9;hp=689ae4d9136e0481282731c4d7136577bcfeabf7;p=ou-summer-of-code-2017.git Merge branch 'master' of git.njae.me.uk:ou-programming-quiz --- diff --git a/08-word-chains/08-offices.txt b/08-word-chains/08-offices.txt new file mode 100644 index 0000000..028c8cf --- /dev/null +++ b/08-word-chains/08-offices.txt @@ -0,0 +1,2336 @@ +abbe +abed +abet +able +ably +abut +aced +aces +ache +achy +acid +acme +acne +acre +acts +adds +adze +aeon +aery +afar +agar +aged +ages +agog +ague +ahem +ahoy +aide +aids +ails +aims +airs +airy +ajar +akin +alas +albs +ales +alga +alit +ally +alms +aloe +also +alto +alum +amen +amid +amir +ammo +amok +amps +anal +anew +ankh +anon +ante +anti +ants +anus +aped +apes +apex +apse +aqua +arch +arcs +area +ares +aria +arid +arks +arms +army +arts +arty +ashy +asks +asps +atom +atop +auks +aunt +aura +auto +aver +avid +avow +away +awed +awes +awls +awol +awry +axed +axes +axis +axle +axon +ayes +baas +babe +baby +back +bade +bags +bail +bait +bake +bald +bale +balk +ball +balm +band +bane +bang +bani +bank +bans +barb +bard +bare +barf +bark +barn +bars +base +bash +bask +bass +bast +bate +bath +bats +baud +bawl +bays +bead +beak +beam +bean +bear +beat +beau +beck +beds +beef +been +beep +beer +bees +beet +begs +bell +belt +bend +bent +berg +berm +best +beta +bets +bevy +bias +bibs +bide +bids +bier +bike +bile +bilk +bill +bind +bins +bird +bite +bits +blab +blah +bled +blew +blip +blob +bloc +blog +blot +blow +blue +blur +boar +boas +boat +bobs +bode +body +bogs +bogy +boil +bola +bold +bole +boll +bolt +bomb +bond +bone +bong +bony +boob +book +boom +boon +boor +boos +boot +bops +bore +born +bosh +boss +both +bout +bowl +bows +boys +bozo +brad +brag +bran +bras +brat +bray +bred +brew +brig +brim +brow +buck +buds +buff +bugs +bulb +bulk +bull +bump +bums +bung +bunk +buns +bunt +buoy +burg +burn +burp +burr +burs +bury +bush +buss +bust +busy +buts +butt +buys +buzz +byes +byte +cabs +cads +cafe +cage +cagy +cake +calf +call +calm +came +camp +cams +cane +cans +cant +cape +caps +card +care +carp +cars +cart +case +cash +cask +cast +cats +cave +caws +cede +cell +cent +chap +char +chat +chef +chew +chic +chid +chin +chip +chit +chop +chow +chug +chum +cite +city +clad +clam +clan +clap +claw +clay +clef +clew +clip +clod +clog +clop +clot +cloy +club +clue +coal +coat +coax +cobs +cock +coda +code +cods +coed +cogs +coif +coil +coin +coke +cola +cold +cols +colt +coma +comb +come +cone +conk +cons +cook +cool +coon +coop +coos +coot +cope +cops +copy +cord +core +cork +corm +corn +cost +cosy +cote +cots +coup +cove +cowl +cows +crab +crag +cram +craw +crew +crib +crop +crow +crud +crux +cube +cubs +cuds +cued +cues +cuff +cull +cult +cums +cups +curb +curd +cure +curl +curs +curt +cusp +cuss +cute +cuts +cyst +czar +dabs +dado +dads +daft +dais +dale +dame +damn +damp +dams +dank +dare +dark +darn +dart +dash +data +date +daub +dawn +days +daze +dead +deaf +deal +dean +dear +debs +debt +deck +deed +deem +deep +deer +deft +defy +deli +dell +demo +dens +dent +deny +desk +dewy +dial +dice +dick +died +dies +diet +digs +dike +dill +dime +dims +dine +ding +dins +dint +dips +dire +dirk +dirt +disc +dish +disk +diss +diva +dive +dock +docs +dodo +doer +does +doff +dogs +dole +doll +dolt +dome +done +dons +doom +door +dope +dopy +dork +dorm +dory +dose +dote +doth +dots +dour +dove +down +doze +drab +drag +dram +draw +dray +drew +drip +drop +drub +drug +drum +drys +dual +dubs +duck +duct +dude +duds +duel +dues +duet +duff +duke +dull +duly +dumb +dump +dune +dung +dunk +duns +duos +dupe +dusk +dust +duty +dyed +dyer +dyes +dyke +each +earl +earn +ears +ease +east +easy +eats +eave +ebbs +echo +ecru +eddy +edge +edgy +edit +eels +eery +eggs +egis +egos +eked +ekes +elan +elks +ells +elms +else +emir +emit +emus +ends +envy +eons +epee +epic +eras +ergo +ergs +errs +espy +etch +euro +even +ever +eves +evil +ewer +ewes +exam +exec +exes +exit +expo +eyed +eyes +face +fact +fade +fads +fags +fail +fain +fair +fake +fall +fame +fang +fans +fare +farm +fast +fate +fats +faun +fawn +faze +fear +feat +feds +feed +feel +fees +feet +fell +felt +fend +fens +fern +fest +feta +fete +feud +fiat +fibs +fief +fife +figs +file +fill +film +find +fine +fink +fins +fire +firm +firs +fish +fist +fits +five +fizz +flab +flag +flak +flan +flap +flat +flaw +flax +flay +flea +fled +flee +flew +flex +flip +flit +floe +flog +flop +flow +flub +flue +flux +foal +foam +fobs +foci +foes +fogs +fogy +foil +fold +folk +fond +font +food +fool +foot +fops +fora +ford +fore +fork +form +fort +foul +four +fowl +foxy +frat +fray +free +fret +frog +from +fuel +full +fume +fund +funk +furl +furs +fury +fuse +fuss +futz +fuze +fuzz +gabs +gads +gaff +gage +gags +gain +gait +gala +gale +gall +gals +game +gamy +gang +gape +gaps +garb +gash +gasp +gate +gave +gawk +gays +gaze +gear +geed +geek +gees +geez +geld +gels +gelt +gems +gene +gent +germ +gets +gibe +gift +gigs +gild +gill +gilt +gins +gird +girl +girt +gist +give +glad +glee +glen +glib +glob +glop +glow +glue +glum +glut +gnat +gnaw +gnus +goad +goal +goat +gobs +gods +goes +gold +golf +gone +gong +good +goof +gook +goon +goop +gore +gory +gosh +gout +gown +grab +grad +gram +gray +grew +grey +grid +grim +grin +grip +grit +grog +grow +grub +guff +gulf +gull +gulp +gums +gunk +guns +guru +gush +gust +guts +guys +gybe +gyms +gyps +gyro +hack +haft +hags +hail +hair +hake +hale +half +hall +halo +halt +hams +hand +hang +hank +hard +hare +hark +harm +harp +hart +hash +hasp +hate +hath +hats +haul +have +hawk +haws +hays +haze +hazy +head +heal +heap +hear +heat +heck +heed +heel +heft +heir +held +hell +helm +help +hemp +hems +hens +herb +herd +here +hero +hers +hewn +hews +hick +hide +hied +hies +high +hike +hill +hilt +hims +hind +hint +hips +hire +hiss +hits +hive +hoax +hobo +hobs +hock +hods +hoed +hoes +hogs +hold +hole +holy +home +homy +hone +honk +hood +hoof +hook +hoop +hoot +hope +hops +horn +hose +host +hour +hove +howl +hows +hubs +hued +hues +huff +huge +hugs +hula +hulk +hull +hump +hums +hung +hunk +hunt +hurl +hurt +hush +husk +huts +hymn +hype +hypo +iamb +ibex +ibis +iced +ices +icky +icon +idea +ides +idle +idly +idol +idyl +iffy +ikon +ilks +ills +imam +imps +inch +info +inks +inky +inns +into +ions +iota +iris +irks +iron +isle +isms +itch +item +jabs +jack +jade +jags +jail +jamb +jams +jape +jars +jaws +jays +jazz +jeep +jeer +jeez +jell +jerk +jest +jets +jibe +jibs +jigs +jilt +jinn +jinx +jive +jobs +jock +jogs +john +join +joke +jolt +josh +jots +jowl +joys +judo +jugs +jump +junk +jury +just +jute +juts +kale +keel +keen +keep +kegs +kelp +kens +kept +kerb +keys +khan +kick +kids +kill +kiln +kilo +kilt +kind +king +kink +kiss +kite +kith +kits +kiwi +knee +knew +knit +knob +knot +know +kook +labs +lace +lack +lacy +lade +lads +lady +lags +laid +lain +lair +lake +lama +lamb +lame +lamp +lams +land +lane +lank +laps +lard +lark +lash +lass +last +late +lath +lats +laud +lava +lawn +laws +lays +laze +lazy +lead +leaf +leak +lean +leap +leas +leek +leer +lees +left +legs +leis +lend +lens +lent +lept +less +lest +lets +levy +lewd +liar +lice +lick +lids +lied +lief +lien +lies +lieu +life +lift +like +lilt +lily +limb +lime +limn +limo +limp +limy +line +link +lint +lion +lips +lira +lire +lisp +list +lite +live +load +loaf +loam +loan +lobe +lobs +loci +lock +loco +lode +loft +loge +logo +logs +loin +loll +lone +long +look +loom +loon +loop +loot +lope +lops +lord +lore +lorn +lose +loss +lost +loth +lots +loud +lout +love +lows +luau +lube +luck +lugs +lull +lump +lung +lure +lurk +lush +lust +lute +lynx +lyre +mace +made +mads +maid +mail +maim +main +make +male +mall +malt +mama +mane +mans +many +maps +mare +mark +mars +mart +mash +mask +mass +mast +mate +math +mats +matt +maul +maws +mayo +maze +mead +meal +mean +meat +meek +meet +megs +meld +melt +memo +mend +menu +meow +mere +mesa +mesh +mess +mete +mewl +mews +mica +mice +mien +miff +mike +mild +mile +milk +mill +mils +mime +mind +mine +mini +mink +mint +minx +mire +miss +mist +mite +mitt +moan +moat +mobs +mock +mode +mods +mold +mole +moll +moms +monk +mono +mood +moon +moor +moos +moot +mope +mops +more +morn +moss +most +mote +moth +move +mown +mows +much +muck +muff +mugs +mule +mull +mums +murk +muse +mush +musk +muss +must +mute +mutt +myna +myth +nabs +nags +nail +name +nape +naps +narc +nark +nary +nave +navy +nays +near +neat +neck +need +neon +nerd +nest +nets +news +newt +next +nibs +nice +nick +nigh +nine +nips +nite +nits +node +nods +noel +noes +none +nook +noon +nope +norm +nose +nosh +nosy +note +noun +nous +nova +nubs +nude +nuke +null +numb +nuns +nuts +oafs +oaks +oars +oath +oats +obey +obit +oboe +odds +odes +odor +offs +ogle +ogre +ohms +oils +oily +oink +okra +oleo +omen +omit +once +ones +only +onto +onus +onyx +oops +ooze +opal +open +opts +opus +oral +orbs +ores +orgy +ouch +ours +oust +outs +oval +oven +over +ovum +owed +owes +owls +owns +oxen +pace +pack +pact +pads +page +paid +pail +pain +pair +pale +pall +palm +pals +pane +pang +pans +pant +papa +paps +pare +park +pars +part +pass +past +pate +path +pats +pave +pawl +pawn +paws +pays +peak +peal +pear +peas +peat +peck +peed +peek +peel +peep +peer +pees +pegs +pelt +pens +pent +peon +peps +perk +perm +pert +peso +pest +pets +pews +pica +pick +pied +pier +pies +pigs +pike +pile +pill +pimp +pine +ping +pink +pins +pint +pipe +pips +pita +pith +pits +pity +pixy +plan +play +plea +pled +plod +plop +plot +ploy +plug +plum +plus +pock +pods +poem +poet +poke +poky +pole +poll +polo +pols +pomp +pond +pone +pony +pooh +pool +poop +poor +pope +pops +pore +pork +porn +port +pose +posh +post +posy +pots +pour +pout +pram +pray +prep +prey +prig +prim +prod +prof +prom +prop +pros +prow +psst +pubs +puck +puff +pugs +puke +pull +pulp +puma +pump +punk +puns +punt +puny +pupa +pups +pure +purl +purr +push +puss +puts +putt +pyre +quad +quay +quid +quip +quit +quiz +race +rack +racy +raft +raga +rage +rags +raid +rail +rain +raja +rake +ramp +rams +rang +rank +rant +rape +raps +rapt +rare +rash +rasp +rate +rats +rave +rays +raze +razz +read +real +ream +reap +rear +redo +reds +reed +reef +reek +reel +refs +rein +reis +rely +rend +rent +reps +rest +revs +rhea +ribs +rice +rich +rick +ride +rids +rife +riff +rift +rigs +rile +rill +rime +rims +rind +ring +rink +riot +ripe +rips +rise +risk +rite +road +roam +roan +roar +robe +robs +rock +rode +rods +roes +roil +role +roll +romp +rood +roof +rook +room +root +rope +rose +rosy +rote +rots +roue +rout +rove +rows +rube +rubs +ruby +rude +rued +rues +ruff +rugs +ruin +rule +rump +rums +rune +rung +runs +runt +ruse +rush +rusk +rust +ruts +sack +sacs +safe +saga +sage +sago +sags +said +sail +sake +saki +sale +salt +same +sand +sane +sang +sank +sans +saps +sari +sash +sass +sate +save +sawn +saws +says +scab +scad +scam +scan +scar +scat +scow +scud +scum +seal +seam +sear +seas +seat +secs +sect +seed +seek +seem +seen +seep +seer +sees +self +sell +semi +send +sent +sera +sere +serf +sets +sewn +sews +sexy +shad +shag +shah +sham +shat +shed +shes +shim +shin +ship +shod +shoe +shoo +shop +shot +show +shun +shut +sick +sics +side +sift +sigh +sign +silk +sill +silo +silt +sine +sing +sink +sins +sips +sire +sirs +site +sits +size +skew +skid +skim +skin +skip +skis +skit +slab +slag +slam +slap +slat +slaw +slay +sled +slew +slid +slim +slip +slit +slob +sloe +slog +slop +slot +slow +slue +slug +slum +slur +slut +smit +smog +smug +smut +snag +snap +snip +snit +snob +snot +snow +snub +snug +soak +soap +soar +sobs +sock +soda +sods +sofa +soft +soil +sold +sole +soli +solo +sols +some +song +sons +soon +soot +sops +sore +sort +sots +soul +soup +sour +sown +sows +soya +span +spar +spas +spat +spay +spec +sped +spew +spin +spit +spot +spry +spud +spun +spur +stab +stag +star +stay +stem +step +stew +stir +stop +stow +stub +stud +stun +stye +subs +such +suck +suds +sued +sues +suet +suit +sulk +sumo +sump +sums +sung +sunk +suns +sups +sure +surf +swab +swag +swam +swan +swap +swat +sway +swig +swim +swop +swum +sync +tabs +tabu +tack +taco +tact +tads +tags +tail +take +talc +tale +talk +tall +tame +tamp +tams +tang +tank +tans +tape +taps +tare +taro +tarp +tars +tart +task +tats +taut +taxi +teak +teal +team +tear +teas +teat +teed +teem +teen +tees +tell +temp +tend +tens +tent +term +tern +test +text +than +that +thaw +thee +them +then +they +thin +this +thou +thru +thud +thug +thus +tick +tics +tide +tidy +tied +tier +ties +tiff +tike +tile +till +tilt +time +tine +ting +tins +tint +tiny +tipi +tips +tire +tiro +tits +toad +toed +toes +tofu +toga +togs +toil +toke +told +toll +tomb +tome +toms +tone +tong +tons +tony +took +tool +toot +tops +tore +torn +tors +tort +toss +tost +tote +tots +tour +tout +town +tows +toys +tram +trap +tray +tree +trek +trig +trim +trio +trip +trod +trot +troy +true +tsar +tuba +tube +tubs +tuck +tuft +tugs +tuna +tune +tuns +turd +turf +turn +tush +tusk +tutu +twee +twig +twin +twit +twos +tyke +type +typo +tyre +tyro +tzar +ugly +ulna +umps +undo +unit +unto +upon +urea +urge +uric +urns +used +user +uses +vain +vale +vamp +vane +vans +vary +vase +vast +vats +veal +veep +veer +veil +vein +veld +vend +vent +verb +very +vest +veto +vets +vial +vibe +vice +vied +vies +view +vile +vine +viol +visa +vise +viva +void +vole +volt +vote +vows +wade +wadi +wads +waft +wage +wags +waif +wail +wait +wake +wale +walk +wall +wand +wane +want +ward +ware +warm +warn +warp +wars +wart +wary +wash +wasp +watt +wave +wavy +waxy +ways +weak +weal +wean +wear +webs +weds +weed +week +weep +weer +wees +weft +weir +weld +well +welt +wend +wens +went +wept +were +west +wets +wham +what +when +whet +whew +whey +whim +whip +whir +whit +whiz +whoa +whom +whys +wick +wide +wife +wigs +wiki +wild +wile +will +wilt +wily +wimp +wind +wine +wing +wink +wino +wins +wipe +wire +wiry +wise +wish +wisp +wist +with +wits +wive +woes +woke +woks +wolf +womb +wont +wood +woof +wool +woos +word +wore +work +worm +worn +wove +wows +wrap +wren +writ +wuss +yack +yaks +yams +yank +yaps +yard +yarn +yawl +yawn +yaws +yeah +year +yeas +yell +yelp +yens +yeps +yest +yeti +yews +yips +yock +yoga +yogi +yoke +yolk +yore +your +yous +yowl +yuck +yuks +yule +yups +zany +zaps +zeal +zebu +zeds +zero +zest +zeta +zinc +zing +zips +zits +zone +zoom +zoos \ No newline at end of file diff --git a/08-word-chains/08-words.txt b/08-word-chains/08-words.txt deleted file mode 100644 index 028c8cf..0000000 --- a/08-word-chains/08-words.txt +++ /dev/null @@ -1,2336 +0,0 @@ -abbe -abed -abet -able -ably -abut -aced -aces -ache -achy -acid -acme -acne -acre -acts -adds -adze -aeon -aery -afar -agar -aged -ages -agog -ague -ahem -ahoy -aide -aids -ails -aims -airs -airy -ajar -akin -alas -albs -ales -alga -alit -ally -alms -aloe -also -alto -alum -amen -amid -amir -ammo -amok -amps -anal -anew -ankh -anon -ante -anti -ants -anus -aped -apes -apex -apse -aqua -arch -arcs -area -ares -aria -arid -arks -arms -army -arts -arty -ashy -asks -asps -atom -atop -auks -aunt -aura -auto -aver -avid -avow -away -awed -awes -awls -awol -awry -axed -axes -axis -axle -axon -ayes -baas -babe -baby -back -bade -bags -bail -bait -bake -bald -bale -balk -ball -balm -band -bane -bang -bani -bank -bans -barb -bard -bare -barf -bark -barn -bars -base -bash -bask -bass -bast -bate -bath -bats -baud -bawl -bays -bead -beak -beam -bean -bear -beat -beau -beck -beds -beef -been -beep -beer -bees -beet -begs -bell -belt -bend -bent -berg -berm -best -beta -bets -bevy -bias -bibs -bide -bids -bier -bike -bile -bilk -bill -bind -bins -bird -bite -bits -blab -blah -bled -blew -blip -blob -bloc -blog -blot -blow -blue -blur -boar -boas -boat -bobs -bode -body -bogs -bogy -boil -bola -bold -bole -boll -bolt -bomb -bond -bone -bong -bony -boob -book -boom -boon -boor -boos -boot -bops -bore -born -bosh -boss -both -bout -bowl -bows -boys -bozo -brad -brag -bran -bras -brat -bray -bred -brew -brig -brim -brow -buck -buds -buff -bugs -bulb -bulk -bull -bump -bums -bung -bunk -buns -bunt -buoy -burg -burn -burp -burr -burs -bury -bush -buss -bust -busy -buts -butt -buys -buzz -byes -byte -cabs -cads -cafe -cage -cagy -cake -calf -call -calm -came -camp -cams -cane -cans -cant -cape -caps -card -care -carp -cars -cart -case -cash -cask -cast -cats -cave -caws -cede -cell -cent -chap -char -chat -chef -chew -chic -chid -chin -chip -chit -chop -chow -chug -chum -cite -city -clad -clam -clan -clap -claw -clay -clef -clew -clip -clod -clog -clop -clot -cloy -club -clue -coal -coat -coax -cobs -cock -coda -code -cods -coed -cogs -coif -coil -coin -coke -cola -cold -cols -colt -coma -comb -come -cone -conk -cons -cook -cool -coon -coop -coos -coot -cope -cops -copy -cord -core -cork -corm -corn -cost -cosy -cote -cots -coup -cove -cowl -cows -crab -crag -cram -craw -crew -crib -crop -crow -crud -crux -cube -cubs -cuds -cued -cues -cuff -cull -cult -cums -cups -curb -curd -cure -curl -curs -curt -cusp -cuss -cute -cuts -cyst -czar -dabs -dado -dads -daft -dais -dale -dame -damn -damp -dams -dank -dare -dark -darn -dart -dash -data -date -daub -dawn -days -daze -dead -deaf -deal -dean -dear -debs -debt -deck -deed -deem -deep -deer -deft -defy -deli -dell -demo -dens -dent -deny -desk -dewy -dial -dice -dick -died -dies -diet -digs -dike -dill -dime -dims -dine -ding -dins -dint -dips -dire -dirk -dirt -disc -dish -disk -diss -diva -dive -dock -docs -dodo -doer -does -doff -dogs -dole -doll -dolt -dome -done -dons -doom -door -dope -dopy -dork -dorm -dory -dose -dote -doth -dots -dour -dove -down -doze -drab -drag -dram -draw -dray -drew -drip -drop -drub -drug -drum -drys -dual -dubs -duck -duct -dude -duds -duel -dues -duet -duff -duke -dull -duly -dumb -dump -dune -dung -dunk -duns -duos -dupe -dusk -dust -duty -dyed -dyer -dyes -dyke -each -earl -earn -ears -ease -east -easy -eats -eave -ebbs -echo -ecru -eddy -edge -edgy -edit -eels -eery -eggs -egis -egos -eked -ekes -elan -elks -ells -elms -else -emir -emit -emus -ends -envy -eons -epee -epic -eras -ergo -ergs -errs -espy -etch -euro -even -ever -eves -evil -ewer -ewes -exam -exec -exes -exit -expo -eyed -eyes -face -fact -fade -fads -fags -fail -fain -fair -fake -fall -fame -fang -fans -fare -farm -fast -fate -fats -faun -fawn -faze -fear -feat -feds -feed -feel -fees -feet -fell -felt -fend -fens -fern -fest -feta -fete -feud -fiat -fibs -fief -fife -figs -file -fill -film -find -fine -fink -fins -fire -firm -firs -fish -fist -fits -five -fizz -flab -flag -flak -flan -flap -flat -flaw -flax -flay -flea -fled -flee -flew -flex -flip -flit -floe -flog -flop -flow -flub -flue -flux -foal -foam -fobs -foci -foes -fogs -fogy -foil -fold -folk -fond -font -food -fool -foot -fops -fora -ford -fore -fork -form -fort -foul -four -fowl -foxy -frat -fray -free -fret -frog -from -fuel -full -fume -fund -funk -furl -furs -fury -fuse -fuss -futz -fuze -fuzz -gabs -gads -gaff -gage -gags -gain -gait -gala -gale -gall -gals -game -gamy -gang -gape -gaps -garb -gash -gasp -gate -gave -gawk -gays -gaze -gear -geed -geek -gees -geez -geld -gels -gelt -gems -gene -gent -germ -gets -gibe -gift -gigs -gild -gill -gilt -gins -gird -girl -girt -gist -give -glad -glee -glen -glib -glob -glop -glow -glue -glum -glut -gnat -gnaw -gnus -goad -goal -goat -gobs -gods -goes -gold -golf -gone -gong -good -goof -gook -goon -goop -gore -gory -gosh -gout -gown -grab -grad -gram -gray -grew -grey -grid -grim -grin -grip -grit -grog -grow -grub -guff -gulf -gull -gulp -gums -gunk -guns -guru -gush -gust -guts -guys -gybe -gyms -gyps -gyro -hack -haft -hags -hail -hair -hake -hale -half -hall -halo -halt -hams -hand -hang -hank -hard -hare -hark -harm -harp -hart -hash -hasp -hate -hath -hats -haul -have -hawk -haws -hays -haze -hazy -head -heal -heap -hear -heat -heck -heed -heel -heft -heir -held -hell -helm -help -hemp -hems -hens -herb -herd -here -hero -hers -hewn -hews -hick -hide -hied -hies -high -hike -hill -hilt -hims -hind -hint -hips -hire -hiss -hits -hive -hoax -hobo -hobs -hock -hods -hoed -hoes -hogs -hold -hole -holy -home -homy -hone -honk -hood -hoof -hook -hoop -hoot -hope -hops -horn -hose -host -hour -hove -howl -hows -hubs -hued -hues -huff -huge -hugs -hula -hulk -hull -hump -hums -hung -hunk -hunt -hurl -hurt -hush -husk -huts -hymn -hype -hypo -iamb -ibex -ibis -iced -ices -icky -icon -idea -ides -idle -idly -idol -idyl -iffy -ikon -ilks -ills -imam -imps -inch -info -inks -inky -inns -into -ions -iota -iris -irks -iron -isle -isms -itch -item -jabs -jack -jade -jags -jail -jamb -jams -jape -jars -jaws -jays -jazz -jeep -jeer -jeez -jell -jerk -jest -jets -jibe -jibs -jigs -jilt -jinn -jinx -jive -jobs -jock -jogs -john -join -joke -jolt -josh -jots -jowl -joys -judo -jugs -jump -junk -jury -just -jute -juts -kale -keel -keen -keep -kegs -kelp -kens -kept -kerb -keys -khan -kick -kids -kill -kiln -kilo -kilt -kind -king -kink -kiss -kite -kith -kits -kiwi -knee -knew -knit -knob -knot -know -kook -labs -lace -lack -lacy -lade -lads -lady -lags -laid -lain -lair -lake -lama -lamb -lame -lamp -lams -land -lane -lank -laps -lard -lark -lash -lass -last -late -lath -lats -laud -lava -lawn -laws -lays -laze -lazy -lead -leaf -leak -lean -leap -leas -leek -leer -lees -left -legs -leis -lend -lens -lent -lept -less -lest -lets -levy -lewd -liar -lice -lick -lids -lied -lief -lien -lies -lieu -life -lift -like -lilt -lily -limb -lime -limn -limo -limp -limy -line -link -lint -lion -lips -lira -lire -lisp -list -lite -live -load -loaf -loam -loan -lobe -lobs -loci -lock -loco -lode -loft -loge -logo -logs -loin -loll -lone -long -look -loom -loon -loop -loot -lope -lops -lord -lore -lorn -lose -loss -lost -loth -lots -loud -lout -love -lows -luau -lube -luck -lugs -lull -lump -lung -lure -lurk -lush -lust -lute -lynx -lyre -mace -made -mads -maid -mail -maim -main -make -male -mall -malt -mama -mane -mans -many -maps -mare -mark -mars -mart -mash -mask -mass -mast -mate -math -mats -matt -maul -maws -mayo -maze -mead -meal -mean -meat -meek -meet -megs -meld -melt -memo -mend -menu -meow -mere -mesa -mesh -mess -mete -mewl -mews -mica -mice -mien -miff -mike -mild -mile -milk -mill -mils -mime -mind -mine -mini -mink -mint -minx -mire -miss -mist -mite -mitt -moan -moat -mobs -mock -mode -mods -mold -mole -moll -moms -monk -mono -mood -moon -moor -moos -moot -mope -mops -more -morn -moss -most -mote -moth -move -mown -mows -much -muck -muff -mugs -mule -mull -mums -murk -muse -mush -musk -muss -must -mute -mutt -myna -myth -nabs -nags -nail -name -nape -naps -narc -nark -nary -nave -navy -nays -near -neat -neck -need -neon -nerd -nest -nets -news -newt -next -nibs -nice -nick -nigh -nine -nips -nite -nits -node -nods -noel -noes -none -nook -noon -nope -norm -nose -nosh -nosy -note -noun -nous -nova -nubs -nude -nuke -null -numb -nuns -nuts -oafs -oaks -oars -oath -oats -obey -obit -oboe -odds -odes -odor -offs -ogle -ogre -ohms -oils -oily -oink -okra -oleo -omen -omit -once -ones -only -onto -onus -onyx -oops -ooze -opal -open -opts -opus -oral -orbs -ores -orgy -ouch -ours -oust -outs -oval -oven -over -ovum -owed -owes -owls -owns -oxen -pace -pack -pact -pads -page -paid -pail -pain -pair -pale -pall -palm -pals -pane -pang -pans -pant -papa -paps -pare -park -pars -part -pass -past -pate -path -pats -pave -pawl -pawn -paws -pays -peak -peal -pear -peas -peat -peck -peed -peek -peel -peep -peer -pees -pegs -pelt -pens -pent -peon -peps -perk -perm -pert -peso -pest -pets -pews -pica -pick -pied -pier -pies -pigs -pike -pile -pill -pimp -pine -ping -pink -pins -pint -pipe -pips -pita -pith -pits -pity -pixy -plan -play -plea -pled -plod -plop -plot -ploy -plug -plum -plus -pock -pods -poem -poet -poke -poky -pole -poll -polo -pols -pomp -pond -pone -pony -pooh -pool -poop -poor -pope -pops -pore -pork -porn -port -pose -posh -post -posy -pots -pour -pout -pram -pray -prep -prey -prig -prim -prod -prof -prom -prop -pros -prow -psst -pubs -puck -puff -pugs -puke -pull -pulp -puma -pump -punk -puns -punt -puny -pupa -pups -pure -purl -purr -push -puss -puts -putt -pyre -quad -quay -quid -quip -quit -quiz -race -rack -racy -raft -raga -rage -rags -raid -rail -rain -raja -rake -ramp -rams -rang -rank -rant -rape -raps -rapt -rare -rash -rasp -rate -rats -rave -rays -raze -razz -read -real -ream -reap -rear -redo -reds -reed -reef -reek -reel -refs -rein -reis -rely -rend -rent -reps -rest -revs -rhea -ribs -rice -rich -rick -ride -rids -rife -riff -rift -rigs -rile -rill -rime -rims -rind -ring -rink -riot -ripe -rips -rise -risk -rite -road -roam -roan -roar -robe -robs -rock -rode -rods -roes -roil -role -roll -romp -rood -roof -rook -room -root -rope -rose -rosy -rote -rots -roue -rout -rove -rows -rube -rubs -ruby -rude -rued -rues -ruff -rugs -ruin -rule -rump -rums -rune -rung -runs -runt -ruse -rush -rusk -rust -ruts -sack -sacs -safe -saga -sage -sago -sags -said -sail -sake -saki -sale -salt -same -sand -sane -sang -sank -sans -saps -sari -sash -sass -sate -save -sawn -saws -says -scab -scad -scam -scan -scar -scat -scow -scud -scum -seal -seam -sear -seas -seat -secs -sect -seed -seek -seem -seen -seep -seer -sees -self -sell -semi -send -sent -sera -sere -serf -sets -sewn -sews -sexy -shad -shag -shah -sham -shat -shed -shes -shim -shin -ship -shod -shoe -shoo -shop -shot -show -shun -shut -sick -sics -side -sift -sigh -sign -silk -sill -silo -silt -sine -sing -sink -sins -sips -sire -sirs -site -sits -size -skew -skid -skim -skin -skip -skis -skit -slab -slag -slam -slap -slat -slaw -slay -sled -slew -slid -slim -slip -slit -slob -sloe -slog -slop -slot -slow -slue -slug -slum -slur -slut -smit -smog -smug -smut -snag -snap -snip -snit -snob -snot -snow -snub -snug -soak -soap -soar -sobs -sock -soda -sods -sofa -soft -soil -sold -sole -soli -solo -sols -some -song -sons -soon -soot -sops -sore -sort -sots -soul -soup -sour -sown -sows -soya -span -spar -spas -spat -spay -spec -sped -spew -spin -spit -spot -spry -spud -spun -spur -stab -stag -star -stay -stem -step -stew -stir -stop -stow -stub -stud -stun -stye -subs -such -suck -suds -sued -sues -suet -suit -sulk -sumo -sump -sums -sung -sunk -suns -sups -sure -surf -swab -swag -swam -swan -swap -swat -sway -swig -swim -swop -swum -sync -tabs -tabu -tack -taco -tact -tads -tags -tail -take -talc -tale -talk -tall -tame -tamp -tams -tang -tank -tans -tape -taps -tare -taro -tarp -tars -tart -task -tats -taut -taxi -teak -teal -team -tear -teas -teat -teed -teem -teen -tees -tell -temp -tend -tens -tent -term -tern -test -text -than -that -thaw -thee -them -then -they -thin -this -thou -thru -thud -thug -thus -tick -tics -tide -tidy -tied -tier -ties -tiff -tike -tile -till -tilt -time -tine -ting -tins -tint -tiny -tipi -tips -tire -tiro -tits -toad -toed -toes -tofu -toga -togs -toil -toke -told -toll -tomb -tome -toms -tone -tong -tons -tony -took -tool -toot -tops -tore -torn -tors -tort -toss -tost -tote -tots -tour -tout -town -tows -toys -tram -trap -tray -tree -trek -trig -trim -trio -trip -trod -trot -troy -true -tsar -tuba -tube -tubs -tuck -tuft -tugs -tuna -tune -tuns -turd -turf -turn -tush -tusk -tutu -twee -twig -twin -twit -twos -tyke -type -typo -tyre -tyro -tzar -ugly -ulna -umps -undo -unit -unto -upon -urea -urge -uric -urns -used -user -uses -vain -vale -vamp -vane -vans -vary -vase -vast -vats -veal -veep -veer -veil -vein -veld -vend -vent -verb -very -vest -veto -vets -vial -vibe -vice -vied -vies -view -vile -vine -viol -visa -vise -viva -void -vole -volt -vote -vows -wade -wadi -wads -waft -wage -wags -waif -wail -wait -wake -wale -walk -wall -wand -wane -want -ward -ware -warm -warn -warp -wars -wart -wary -wash -wasp -watt -wave -wavy -waxy -ways -weak -weal -wean -wear -webs -weds -weed -week -weep -weer -wees -weft -weir -weld -well -welt -wend -wens -went -wept -were -west -wets -wham -what -when -whet -whew -whey -whim -whip -whir -whit -whiz -whoa -whom -whys -wick -wide -wife -wigs -wiki -wild -wile -will -wilt -wily -wimp -wind -wine -wing -wink -wino -wins -wipe -wire -wiry -wise -wish -wisp -wist -with -wits -wive -woes -woke -woks -wolf -womb -wont -wood -woof -wool -woos -word -wore -work -worm -worn -wove -wows -wrap -wren -writ -wuss -yack -yaks -yams -yank -yaps -yard -yarn -yawl -yawn -yaws -yeah -year -yeas -yell -yelp -yens -yeps -yest -yeti -yews -yips -yock -yoga -yogi -yoke -yolk -yore -your -yous -yowl -yuck -yuks -yule -yups -zany -zaps -zeal -zebu -zeds -zero -zest -zeta -zinc -zing -zips -zits -zone -zoom -zoos \ No newline at end of file diff --git a/08-word-chains/explore-word-chain-4.ipynb b/08-word-chains/explore-word-chain-4.ipynb index c2bca54..da9196a 100644 --- a/08-word-chains/explore-word-chain-4.ipynb +++ b/08-word-chains/explore-word-chain-4.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 4, "metadata": { "collapsed": true }, @@ -16,7 +16,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 5, "metadata": { "collapsed": false }, @@ -27,19 +27,19 @@ "2336" ] }, - "execution_count": 2, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "words = [w.strip() for w in open('08-words.txt').readlines()]\n", + "words = [w.strip() for w in open('08-offices.txt').readlines()]\n", "len(words)" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 6, "metadata": { "collapsed": false }, @@ -59,7 +59,7 @@ " 'achy']" ] }, - "execution_count": 3, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -70,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 7, "metadata": { "collapsed": true }, @@ -87,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 8, "metadata": { "collapsed": true }, @@ -102,7 +102,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 9, "metadata": { "collapsed": true }, @@ -114,7 +114,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 10, "metadata": { "collapsed": false }, @@ -125,7 +125,7 @@ "['able']" ] }, - "execution_count": 7, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -136,7 +136,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 11, "metadata": { "collapsed": false }, @@ -147,7 +147,7 @@ "['axle', 'abbe', 'ably']" ] }, - "execution_count": 8, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -158,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 12, "metadata": { "collapsed": true }, @@ -171,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 13, "metadata": { "collapsed": false }, @@ -182,7 +182,7 @@ "0" ] }, - "execution_count": 10, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -193,7 +193,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 14, "metadata": { "collapsed": true }, @@ -210,7 +210,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 15, "metadata": { "collapsed": false }, @@ -221,7 +221,7 @@ "[['abbe', 'able']]" ] }, - "execution_count": 12, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -232,7 +232,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 16, "metadata": { "collapsed": false }, @@ -243,7 +243,7 @@ "[['abbe', 'able', 'axle'], ['abbe', 'able', 'ably']]" ] }, - "execution_count": 13, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -254,7 +254,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 17, "metadata": { "collapsed": false }, @@ -265,7 +265,7 @@ "[['abbe', 'able', 'ably', 'ally']]" ] }, - "execution_count": 14, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -276,7 +276,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 18, "metadata": { "collapsed": true }, @@ -302,7 +302,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 19, "metadata": { "collapsed": true }, @@ -330,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 20, "metadata": { "collapsed": false }, @@ -352,7 +352,7 @@ "['abbe', 'able', 'ably', 'ally']" ] }, - "execution_count": 17, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -363,7 +363,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 21, "metadata": { "collapsed": true }, @@ -389,7 +389,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 22, "metadata": { "collapsed": false }, @@ -411,7 +411,7 @@ "['abbe', 'able', 'ably', 'ally']" ] }, - "execution_count": 19, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -422,7 +422,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 23, "metadata": { "collapsed": false }, @@ -1567,7 +1567,7 @@ "['cart', 'cant', 'cans', 'vans']" ] }, - "execution_count": 20, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -1578,7 +1578,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 24, "metadata": { "collapsed": false }, @@ -1589,7 +1589,7 @@ "['cart', 'cant', 'cane', 'vane']" ] }, - "execution_count": 21, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -1600,7 +1600,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 25, "metadata": { "collapsed": false }, @@ -2188,7 +2188,7 @@ " 'vane']" ] }, - "execution_count": 22, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -2199,7 +2199,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 26, "metadata": { "collapsed": true }, @@ -2227,7 +2227,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 27, "metadata": { "collapsed": false }, @@ -2248,7 +2248,7 @@ "['cart', 'cant', 'cane', 'vane']" ] }, - "execution_count": 24, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -2259,7 +2259,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 28, "metadata": { "collapsed": true }, @@ -2289,7 +2289,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 29, "metadata": { "collapsed": false }, @@ -2310,7 +2310,7 @@ "['cart', 'cant', 'cane', 'vane']" ] }, - "execution_count": 26, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } @@ -2330,7 +2330,7 @@ }, { "cell_type": "code", - "execution_count": 77, + "execution_count": 30, "metadata": { "collapsed": false }, @@ -2341,7 +2341,7 @@ "94" ] }, - "execution_count": 77, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -2367,7 +2367,7 @@ }, { "cell_type": "code", - "execution_count": 78, + "execution_count": 31, "metadata": { "collapsed": false }, @@ -2378,7 +2378,7 @@ "2204" ] }, - "execution_count": 78, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -2389,7 +2389,7 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": 32, "metadata": { "collapsed": false }, @@ -2400,7 +2400,7 @@ "1" ] }, - "execution_count": 79, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } @@ -2411,7 +2411,7 @@ }, { "cell_type": "code", - "execution_count": 80, + "execution_count": 33, "metadata": { "collapsed": false, "scrolled": true @@ -2423,7 +2423,7 @@ "Counter({1: 75, 2: 6, 3: 7, 4: 2, 5: 2, 6: 1, 2204: 1})" ] }, - "execution_count": 80, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -2434,7 +2434,7 @@ }, { "cell_type": "code", - "execution_count": 81, + "execution_count": 34, "metadata": { "collapsed": false }, @@ -2445,7 +2445,7 @@ "[5]" ] }, - "execution_count": 81, + "execution_count": 34, "metadata": {}, "output_type": "execute_result" } @@ -2456,7 +2456,7 @@ }, { "cell_type": "code", - "execution_count": 82, + "execution_count": 35, "metadata": { "collapsed": false }, @@ -2467,7 +2467,7 @@ "[{'abbe', 'able', 'ably', 'ally', 'axle'}]" ] }, - "execution_count": 82, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -2478,7 +2478,7 @@ }, { "cell_type": "code", - "execution_count": 83, + "execution_count": 36, "metadata": { "collapsed": false }, @@ -2489,7 +2489,7 @@ "['buns', 'bunk', 'punk']" ] }, - "execution_count": 83, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } @@ -2500,7 +2500,7 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 37, "metadata": { "collapsed": true }, @@ -2515,7 +2515,7 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": 38, "metadata": { "collapsed": true }, @@ -2538,7 +2538,7 @@ }, { "cell_type": "code", - "execution_count": 86, + "execution_count": 39, "metadata": { "collapsed": true }, @@ -2549,7 +2549,7 @@ }, { "cell_type": "code", - "execution_count": 87, + "execution_count": 40, "metadata": { "collapsed": false }, @@ -2558,26 +2558,26 @@ "name": "stdout", "output_type": "stream", "text": [ - "['late', 'lats', 'lets', 'leas', 'seas', 'seam', 'swam', 'sway']\n", - "['leap', 'heap', 'hear', 'dear', 'deer']\n", - "['peel', 'peek', 'perk', 'park', 'nark']\n", - "['sing', 'sang', 'sand', 'said', 'sail', 'hail', 'haul']\n", - "['vats', 'bats', 'bets', 'bees', 'been', 'teen', 'then', 'thin', 'this', 'thus', 'thud']\n", - "['sues', 'sees', 'seen', 'sewn', 'hewn']\n", - "['rash', 'bash', 'bast', 'bait', 'bail', 'hail', 'hair', 'heir']\n", - "['apex', 'aped', 'sped', 'seed', 'deed', 'dead', 'deal', 'veal']\n", - "['gulf', 'golf', 'gold', 'bold', 'bond', 'bony', 'tony']\n", - "['snag', 'shag', 'shat', 'seat', 'peat', 'pent', 'pint', 'mint']\n", - "['rife', 'rime', 'rims', 'rums', 'cums', 'cuss']\n", - "['diss', 'kiss', 'kits']\n", - "['gyps', 'gaps', 'gads', 'wads', 'wade', 'wide', 'tide']\n", - "['bilk', 'bill', 'bell', 'tell', 'teal', 'tear', 'tzar']\n", - "['logo', 'loge', 'lode', 'lade', 'jade', 'jape']\n", - "['hunt', 'bunt', 'buns', 'nuns', 'nubs']\n", - "['glow', 'glop', 'plop', 'prop', 'prep', 'peep', 'keep']\n", - "['iamb', 'lamb', 'lams', 'laps', 'lips', 'pips']\n", - "['pain', 'lain', 'laid', 'land', 'lend', 'vend', 'veld']\n", - "['fake', 'bake', 'bare', 'bars', 'ears', 'errs', 'ergs', 'eggs', 'egos']\n" + "['bops', 'bogs', 'begs', 'bees', 'byes', 'eyes', 'eyed']\n", + "['foal', 'foil', 'fail']\n", + "['bush', 'bash', 'base', 'bale', 'ball', 'boll']\n", + "['rift', 'lift', 'life', 'live', 'give', 'gave']\n", + "['club', 'clue', 'flue', 'flee', 'fled', 'pled', 'pied', 'lied', 'lien', 'mien']\n", + "['rung', 'dung', 'ding', 'dins', 'dies', 'lies', 'lien']\n", + "['baas', 'bags', 'bugs', 'bums', 'sums', 'sumo']\n", + "['fits', 'bits', 'bins', 'bind']\n", + "['lids', 'bids', 'bias', 'boas', 'boat', 'boot', 'soot', 'snot', 'snob']\n", + "['cake', 'came', 'cams', 'caws', 'cows', 'tows']\n", + "['tort', 'toot', 'trot', 'troy', 'tray', 'tram', 'cram']\n", + "['sews', 'pews', 'pees', 'peed', 'pied']\n", + "['lack', 'hack', 'hawk', 'haws', 'hows', 'tows']\n", + "['dots', 'dons', 'dens', 'dent', 'pent', 'pest', 'peso']\n", + "['ekes', 'eyes', 'byes', 'bees', 'beet', 'bent', 'lent', 'lept']\n", + "['ruin', 'rain', 'gain', 'grin', 'grid', 'arid', 'acid', 'aced', 'iced']\n", + "['sing', 'sins', 'bins', 'bias', 'bras', 'bray', 'tray', 'trap']\n", + "['lira', 'lire', 'wire', 'wise', 'wish']\n", + "['gash', 'cash', 'case', 'cape', 'rape']\n", + "['crop', 'coop', 'coot', 'loot', 'loft']\n" ] } ], @@ -2589,7 +2589,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 41, "metadata": { "collapsed": false }, @@ -2600,7 +2600,7 @@ "['cops', 'coos', 'coon', 'coin', 'chin', 'thin', 'this', 'thus', 'thug']" ] }, - "execution_count": 38, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -2611,7 +2611,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 42, "metadata": { "collapsed": false }, @@ -2622,7 +2622,7 @@ "[2204]" ] }, - "execution_count": 39, + "execution_count": 42, "metadata": {}, "output_type": "execute_result" } @@ -2633,7 +2633,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 73, "metadata": { "collapsed": false }, @@ -2641,21 +2641,21 @@ { "data": { "text/plain": [ - "['hate', 'have', 'hove', 'love']" + "[2204]" ] }, - "execution_count": 40, + "execution_count": 73, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "astar_search('hate', 'love')" + "[len(r) for r in reachables if 'stay' in r ]" ] }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 43, "metadata": { "collapsed": false }, @@ -2663,51 +2663,43 @@ { "data": { "text/plain": [ - "['wars', 'ware', 'wave', 'wove', 'love']" + "['hate', 'have', 'hove', 'love']" ] }, - "execution_count": 41, + "execution_count": 43, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "astar_search('wars', 'love')" + "astar_search('hate', 'love')" ] }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 44, "metadata": { "collapsed": false }, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "CPU times: user 0 ns, sys: 0 ns, total: 0 ns\n", - "Wall time: 210 µs\n" - ] - }, { "data": { "text/plain": [ - "5" + "['wars', 'ware', 'wave', 'wove', 'love']" ] }, - "execution_count": 61, + "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "%time len(astar_search('wars', 'love'))" + "astar_search('wars', 'love')" ] }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 45, "metadata": { "collapsed": false }, @@ -2717,7 +2709,7 @@ "output_type": "stream", "text": [ "CPU times: user 0 ns, sys: 0 ns, total: 0 ns\n", - "Wall time: 252 µs\n" + "Wall time: 850 µs\n" ] }, { @@ -2726,18 +2718,18 @@ "5" ] }, - "execution_count": 62, + "execution_count": 45, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "%time len(astar_search_closed('wars', 'love'))" + "%time len(astar_search('wars', 'love'))" ] }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 46, "metadata": { "collapsed": false }, @@ -2746,28 +2738,28 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 24 ms, sys: 0 ns, total: 24 ms\n", - "Wall time: 24.2 ms\n" + "CPU times: user 0 ns, sys: 0 ns, total: 0 ns\n", + "Wall time: 353 µs\n" ] }, { "data": { "text/plain": [ - "404" + "5" ] }, - "execution_count": 63, + "execution_count": 46, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "%time len(dfs_search('wars', 'love'))" + "%time len(astar_search_closed('wars', 'love'))" ] }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 47, "metadata": { "collapsed": false }, @@ -2776,58 +2768,50 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 5min 20s, sys: 76 ms, total: 5min 20s\n", - "Wall time: 5min 20s\n" + "CPU times: user 76 ms, sys: 0 ns, total: 76 ms\n", + "Wall time: 75.1 ms\n" ] }, { "data": { "text/plain": [ - "5" + "404" ] }, - "execution_count": 64, + "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "%time len(bfs_search('wars', 'love'))" + "%time len(dfs_search('wars', 'love'))" ] }, { "cell_type": "code", - "execution_count": 65, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "CPU times: user 1.44 s, sys: 0 ns, total: 1.44 s\n", - "Wall time: 1.43 s\n" - ] - }, - { - "data": { - "text/plain": [ - "5" - ] - }, - "execution_count": 65, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], + "source": [ + "# %time len(bfs_search('wars', 'love'))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], "source": [ "%time len(bfs_search_closed('wars', 'love'))" ] }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 50, "metadata": { "collapsed": false }, @@ -2838,7 +2822,7 @@ "['fear', 'feat', 'fest', 'lest', 'lost', 'lose', 'love']" ] }, - "execution_count": 42, + "execution_count": 50, "metadata": {}, "output_type": "execute_result" } @@ -2849,7 +2833,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 51, "metadata": { "collapsed": false }, @@ -2860,7 +2844,7 @@ "['fail', 'fall', 'pall', 'pals', 'pass']" ] }, - "execution_count": 43, + "execution_count": 51, "metadata": {}, "output_type": "execute_result" } @@ -2871,7 +2855,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 52, "metadata": { "collapsed": false }, @@ -2882,7 +2866,7 @@ "['star', 'soar', 'boar', 'boor', 'boon', 'born']" ] }, - "execution_count": 44, + "execution_count": 52, "metadata": {}, "output_type": "execute_result" } @@ -2893,7 +2877,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 53, "metadata": { "collapsed": false }, @@ -2914,7 +2898,7 @@ " 'pass']" ] }, - "execution_count": 45, + "execution_count": 53, "metadata": {}, "output_type": "execute_result" } @@ -2925,7 +2909,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 54, "metadata": { "collapsed": false }, @@ -2949,7 +2933,7 @@ " 'past']" ] }, - "execution_count": 46, + "execution_count": 54, "metadata": {}, "output_type": "execute_result" } @@ -2960,7 +2944,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 55, "metadata": { "collapsed": false }, @@ -2971,7 +2955,7 @@ "[1]" ] }, - "execution_count": 47, + "execution_count": 55, "metadata": {}, "output_type": "execute_result" } @@ -2982,7 +2966,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 56, "metadata": { "collapsed": false }, @@ -2993,7 +2977,7 @@ "[2204]" ] }, - "execution_count": 48, + "execution_count": 56, "metadata": {}, "output_type": "execute_result" } @@ -3004,7 +2988,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 57, "metadata": { "collapsed": false }, @@ -3013,7 +2997,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1 loop, best of 3: 7.9 s per loop\n" + "1 loop, best of 3: 12.3 s per loop\n" ] } ], @@ -3024,7 +3008,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 58, "metadata": { "collapsed": false }, @@ -3033,7 +3017,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "10 loops, best of 3: 141 ms per loop\n" + "1 loop, best of 3: 200 ms per loop\n" ] } ], @@ -3044,7 +3028,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 59, "metadata": { "collapsed": false }, @@ -3064,7 +3048,7 @@ " 'exit']" ] }, - "execution_count": 51, + "execution_count": 59, "metadata": {}, "output_type": "execute_result" } @@ -3075,7 +3059,7 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": 60, "metadata": { "collapsed": false }, @@ -3083,23 +3067,23 @@ { "data": { "text/plain": [ - "{2: [['heel', 'keel'], ['wane', 'wave'], ['cell', 'sell'], ['cons', 'cobs']],\n", - " 3: [['hank', 'haws'], ['bars', 'bets'], ['rats', 'paws'], ['lock', 'hack']],\n", - " 4: [['rule', 'sore'], ['wavy', 'rape'], ['peas', 'ping'], ['bond', 'toll']],\n", - " 5: [['cope', 'yowl'], ['lose', 'loci'], ['rump', 'dash'], ['four', 'dyes']],\n", - " 6: [['boon', 'sell'], ['lots', 'pomp'], ['cola', 'turn'], ['boos', 'laid']],\n", - " 7: [['eave', 'inns'], ['meek', 'mere'], ['keys', 'wily'], ['slam', 'yore']],\n", - " 8: [['hack', 'flip'], ['crag', 'huge'], ['flux', 'gill'], ['play', 'busy']],\n", - " 9: [['lacy', 'whey'], ['wren', 'rook'], ['lire', 'drip'], ['grab', 'lame']],\n", - " 10: [['over', 'turn'], ['worn', 'anew'], ['stow', 'elks'], ['ergo', 'rich']],\n", - " 11: [['bask', 'idea'], ['gabs', 'thud'], ['idea', 'clod'], ['mark', 'ibis']],\n", - " 12: [['umps', 'torn'], ['futz', 'shun'], ['abut', 'face'], ['slug', 'open']],\n", - " 13: [['umps', 'skin'], ['chum', 'rats'], ['fury', 'chum'], ['omen', 'zany']],\n", - " 14: [['chug', 'gaff'], ['atom', 'fizz']],\n", - " 15: [['chug', 'oxen']]}" + "{2: [['exes', 'exec'], ['rush', 'tush'], ['wile', 'wily'], ['shoo', 'shot']],\n", + " 3: [['bins', 'fink'], ['waft', 'wand'], ['heel', 'jell'], ['tent', 'west']],\n", + " 4: [['yore', 'polo'], ['hale', 'case'], ['horn', 'look'], ['tang', 'nuns']],\n", + " 5: [['crab', 'baas'], ['yens', 'dead'], ['work', 'paps'], ['tune', 'zaps']],\n", + " 6: [['mist', 'sold'], ['bats', 'sort'], ['leek', 'mads'], ['loop', 'dome']],\n", + " 7: [['rime', 'hoof'], ['grim', 'reed'], ['lies', 'eave'], ['ties', 'whiz']],\n", + " 8: [['drag', 'lied'], ['ages', 'yawl'], ['earl', 'deal'], ['gins', 'scab']],\n", + " 9: [['tyre', 'swum'], ['dike', 'flux'], ['hour', 'laze'], ['trek', 'bait']],\n", + " 10: [['ides', 'rasp'], ['egos', 'racy'], ['shim', 'ills'], ['bark', 'arty']],\n", + " 11: [['ergo', 'apex'], ['whey', 'owns'], ['anew', 'rapt'], ['thug', 'bate']],\n", + " 12: [['ream', 'imps'], ['meat', 'umps'], ['daze', 'knee'], ['clay', 'over']],\n", + " 13: [['oxen', 'blab'], ['blip', 'omen'], ['twig', 'ibis'], ['chew', 'umps']],\n", + " 14: [['amen', 'blip'], ['umps', 'futz'], ['amps', 'glib'], ['chum', 'whys']],\n", + " 15: [['thug', 'ibis']]}" ] }, - "execution_count": 88, + "execution_count": 60, "metadata": {}, "output_type": "execute_result" } @@ -3123,7 +3107,7 @@ }, { "cell_type": "code", - "execution_count": 91, + "execution_count": 64, "metadata": { "collapsed": true }, @@ -3148,29 +3132,7 @@ }, { "cell_type": "code", - "execution_count": 54, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "[('amen', 'doff', 15), ('chug', 'jinn', 14), ('amen', 'flog', 14)]" - ] - }, - "execution_count": 54, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "[(s[0], s[-1], len(s)) for s in solutions if len(s) >= 14]" - ] - }, - { - "cell_type": "code", - "execution_count": 55, + "execution_count": 66, "metadata": { "collapsed": false }, @@ -3179,7 +3141,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1 loop, best of 3: 360 ms per loop\n" + "1 loop, best of 3: 487 ms per loop\n" ] } ], @@ -3190,7 +3152,7 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 67, "metadata": { "collapsed": false }, @@ -3199,8 +3161,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 384 ms, sys: 0 ns, total: 384 ms\n", - "Wall time: 385 ms\n" + "CPU times: user 768 ms, sys: 0 ns, total: 768 ms\n", + "Wall time: 768 ms\n" ] }, { @@ -3209,7 +3171,7 @@ "14" ] }, - "execution_count": 56, + "execution_count": 67, "metadata": {}, "output_type": "execute_result" } @@ -3220,7 +3182,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 68, "metadata": { "collapsed": false }, @@ -3229,8 +3191,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 124 ms, sys: 0 ns, total: 124 ms\n", - "Wall time: 121 ms\n" + "CPU times: user 176 ms, sys: 0 ns, total: 176 ms\n", + "Wall time: 176 ms\n" ] }, { @@ -3239,7 +3201,7 @@ "15" ] }, - "execution_count": 57, + "execution_count": 68, "metadata": {}, "output_type": "execute_result" } @@ -3250,7 +3212,7 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 69, "metadata": { "collapsed": false }, @@ -3259,8 +3221,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 32 ms, sys: 0 ns, total: 32 ms\n", - "Wall time: 32.4 ms\n" + "CPU times: user 72 ms, sys: 0 ns, total: 72 ms\n", + "Wall time: 70.6 ms\n" ] }, { @@ -3269,7 +3231,7 @@ "14" ] }, - "execution_count": 58, + "execution_count": 69, "metadata": {}, "output_type": "execute_result" } @@ -3280,7 +3242,7 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 70, "metadata": { "collapsed": false }, @@ -3289,8 +3251,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 16 ms, sys: 0 ns, total: 16 ms\n", - "Wall time: 17.1 ms\n" + "CPU times: user 32 ms, sys: 0 ns, total: 32 ms\n", + "Wall time: 35.7 ms\n" ] }, { @@ -3299,7 +3261,7 @@ "14" ] }, - "execution_count": 59, + "execution_count": 70, "metadata": {}, "output_type": "execute_result" } @@ -3310,7 +3272,7 @@ }, { "cell_type": "code", - "execution_count": 73, + "execution_count": 71, "metadata": { "collapsed": false }, @@ -3319,8 +3281,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 268 ms, sys: 4 ms, total: 272 ms\n", - "Wall time: 272 ms\n" + "CPU times: user 376 ms, sys: 4 ms, total: 380 ms\n", + "Wall time: 382 ms\n" ] }, { @@ -3329,7 +3291,7 @@ "14" ] }, - "execution_count": 73, + "execution_count": 71, "metadata": {}, "output_type": "execute_result" } @@ -3340,7 +3302,7 @@ }, { "cell_type": "code", - "execution_count": 74, + "execution_count": 72, "metadata": { "collapsed": false }, @@ -3349,8 +3311,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "CPU times: user 64 ms, sys: 0 ns, total: 64 ms\n", - "Wall time: 64.1 ms\n" + "CPU times: user 72 ms, sys: 4 ms, total: 76 ms\n", + "Wall time: 76.9 ms\n" ] }, { @@ -3359,7 +3321,7 @@ "14" ] }, - "execution_count": 74, + "execution_count": 72, "metadata": {}, "output_type": "execute_result" } diff --git a/08-word-chains/word-chain-solution.ipynb b/08-word-chains/word-chain-solution.ipynb index 038b3c4..77dcdae 100644 --- a/08-word-chains/word-chain-solution.ipynb +++ b/08-word-chains/word-chain-solution.ipynb @@ -56,7 +56,7 @@ } ], "source": [ - "words = [w.strip() for w in open('08-words.txt').readlines()]\n", + "words = [w.strip() for w in open('08-offices.txt').readlines()]\n", "len(words)" ] }, @@ -365,7 +365,7 @@ { "data": { "text/plain": [ - "6" + "['boon', 'boot', 'bolt', 'belt', 'bell', 'sell']" ] }, "execution_count": 17, @@ -374,7 +374,7 @@ } ], "source": [ - "len(astar_search('vice', 'wars'))" + "astar_search_raw('boon', 'sell')" ] }, { @@ -385,20 +385,18 @@ }, "outputs": [ { - "ename": "KeyboardInterrupt", - "evalue": "", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbfs_search\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'vice'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'wars'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m\u001b[0m in \u001b[0;36mbfs_search\u001b[0;34m(start, goal, debug)\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0msuccessors\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mextend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcurrent\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 12\u001b[0;31m \u001b[0magenda\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0magenda\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0msuccessors\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 13\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0magenda\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mcurrent\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mKeyboardInterrupt\u001b[0m: " - ] + "data": { + "text/plain": [ + "6" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "len(bfs_search('vice', 'wars'))" + "len(astar_search('vice', 'wars'))" ] }, { @@ -407,6 +405,17 @@ "metadata": { "collapsed": false }, + "outputs": [], + "source": [ + "# len(bfs_search('vice', 'wars'))" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, "outputs": [ { "data": { @@ -414,7 +423,7 @@ "6" ] }, - "execution_count": 19, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -425,7 +434,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 21, "metadata": { "collapsed": false }, @@ -436,7 +445,7 @@ "793" ] }, - "execution_count": 20, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -447,7 +456,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 22, "metadata": { "collapsed": false }, @@ -456,7 +465,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1000 loops, best of 3: 225 µs per loop\n" + "1000 loops, best of 3: 273 µs per loop\n" ] } ], @@ -467,7 +476,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 23, "metadata": { "collapsed": false }, @@ -476,7 +485,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "10 loops, best of 3: 22.1 ms per loop\n" + "10 loops, best of 3: 25.6 ms per loop\n" ] } ], @@ -487,7 +496,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 24, "metadata": { "collapsed": false }, @@ -496,7 +505,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1000 loops, best of 3: 280 µs per loop\n" + "1000 loops, best of 3: 300 µs per loop\n" ] } ], @@ -507,38 +516,19 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 25, "metadata": { "collapsed": false }, - "outputs": [ - { - "ename": "KeyboardInterrupt", - "evalue": "", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mget_ipython\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_cell_magic\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'timeit'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m''\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"bfs_search('vice', 'wars')\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py\u001b[0m in \u001b[0;36mrun_cell_magic\u001b[0;34m(self, magic_name, line, cell)\u001b[0m\n\u001b[1;32m 2113\u001b[0m \u001b[0mmagic_arg_s\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvar_expand\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mline\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstack_depth\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2114\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbuiltin_trap\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2115\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmagic_arg_s\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcell\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2116\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2117\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m\u001b[0m in \u001b[0;36mtimeit\u001b[0;34m(self, line, cell)\u001b[0m\n", - "\u001b[0;32m/usr/local/lib/python3.5/dist-packages/IPython/core/magic.py\u001b[0m in \u001b[0;36m\u001b[0;34m(f, *a, **k)\u001b[0m\n\u001b[1;32m 186\u001b[0m \u001b[0;31m# but it's overkill for just that one bit of state.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 187\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mmagic_deco\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0marg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 188\u001b[0;31m \u001b[0mcall\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mlambda\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 189\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 190\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mcallable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0marg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/usr/local/lib/python3.5/dist-packages/IPython/core/magics/execution.py\u001b[0m in \u001b[0;36mtimeit\u001b[0;34m(self, line, cell)\u001b[0m\n\u001b[1;32m 1042\u001b[0m \u001b[0mnumber\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1043\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0m_\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m10\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1044\u001b[0;31m \u001b[0mtime_number\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtimer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtimeit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnumber\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1045\u001b[0m \u001b[0mworst_tuning\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mworst_tuning\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtime_number\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0mnumber\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1046\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mtime_number\u001b[0m \u001b[0;34m>=\u001b[0m \u001b[0;36m0.2\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/usr/local/lib/python3.5/dist-packages/IPython/core/magics/execution.py\u001b[0m in \u001b[0;36mtimeit\u001b[0;34m(self, number)\u001b[0m\n\u001b[1;32m 137\u001b[0m \u001b[0mgc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdisable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 138\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 139\u001b[0;31m \u001b[0mtiming\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minner\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mit\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtimer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 140\u001b[0m \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mgcold\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m\u001b[0m in \u001b[0;36minner\u001b[0;34m(_it, _timer)\u001b[0m\n", - "\u001b[0;32m\u001b[0m in \u001b[0;36mbfs_search\u001b[0;34m(start, goal, debug)\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0msuccessors\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mextend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcurrent\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 12\u001b[0;31m \u001b[0magenda\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0magenda\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0msuccessors\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 13\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0magenda\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mcurrent\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mKeyboardInterrupt\u001b[0m: " - ] - } - ], + "outputs": [], "source": [ - "%%timeit\n", - "bfs_search('vice', 'wars')" + "# %%timeit\n", + "# bfs_search('vice', 'wars')" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 26, "metadata": { "collapsed": false }, @@ -547,7 +537,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1 loop, best of 3: 1.12 s per loop\n" + "1 loop, best of 3: 664 ms per loop\n" ] } ], @@ -558,7 +548,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 27, "metadata": { "collapsed": false }, @@ -567,7 +557,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "10 loops, best of 3: 127 ms per loop\n" + "10 loops, best of 3: 147 ms per loop\n" ] } ], @@ -594,7 +584,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 28, "metadata": { "collapsed": true }, @@ -616,7 +606,39 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "['bash',\n", + " 'cash',\n", + " 'dash',\n", + " 'gash',\n", + " 'hash',\n", + " 'lash',\n", + " 'mash',\n", + " 'sash',\n", + " 'wash',\n", + " 'rush',\n", + " 'rasp']" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "neighbours['rash']" + ] + }, + { + "cell_type": "code", + "execution_count": 29, "metadata": { "collapsed": false, "scrolled": true @@ -629,7 +651,7 @@ " '`bash`, `cash`, `dash`, `gash`, `hash`, `lash`, `mash`, `rasp`, `rush`, `sash`, `wash`')" ] }, - "execution_count": 28, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } @@ -640,7 +662,31 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 47, + "metadata": { + "collapsed": false, + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "(11,\n", + " 'bash, cash, dash, gash, hash, lash, mash, rasp, rush, sash, wash')" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(reachable_in('rash', 1)), ', '.join(sorted('{}'.format(r) for r in reachable_in('rash', 1)))" + ] + }, + { + "cell_type": "code", + "execution_count": 30, "metadata": { "collapsed": false, "scrolled": true @@ -653,7 +699,7 @@ " '`base`, `bash`, `bask`, `bass`, `bast`, `bath`, `bosh`, `bush`, `case`, `cash`, `cask`, `cast`, `dash`, `dish`, `gash`, `gasp`, `gosh`, `gush`, `hash`, `hasp`, `hath`, `hush`, `lash`, `lass`, `last`, `lath`, `lush`, `mash`, `mask`, `mass`, `mast`, `math`, `mesh`, `mush`, `push`, `ramp`, `rasp`, `ruse`, `rush`, `rusk`, `rust`, `sash`, `sass`, `tush`, `wash`, `wasp`, `wish`')" ] }, - "execution_count": 29, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -664,7 +710,31 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 51, + "metadata": { + "collapsed": false, + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "(47,\n", + " 'base, bash, bask, bass, bast, bath, bosh, bush, case, cash, cask, cast, dash, dish, gash, gasp, gosh, gush, hash, hasp, hath, hush, lash, lass, last, lath, lush, mash, mask, mass, mast, math, mesh, mush, push, ramp, rasp, ruse, rush, rusk, rust, sash, sass, tush, wash, wasp, wish')" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(reachable_in('rash', 2)), ', '.join(sorted('{}'.format(r) for r in reachable_in('rash', 2)))" + ] + }, + { + "cell_type": "code", + "execution_count": 31, "metadata": { "collapsed": false, "scrolled": true @@ -676,7 +746,7 @@ "180" ] }, - "execution_count": 30, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -687,7 +757,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 32, "metadata": { "collapsed": false, "scrolled": true @@ -699,7 +769,7 @@ "2195" ] }, - "execution_count": 31, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } @@ -710,7 +780,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 33, "metadata": { "collapsed": false, "scrolled": true @@ -722,7 +792,7 @@ "2192" ] }, - "execution_count": 32, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -733,7 +803,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 34, "metadata": { "collapsed": false, "scrolled": true @@ -743,7 +813,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "100 loops, best of 3: 9.26 ms per loop\n" + "100 loops, best of 3: 8.95 ms per loop\n" ] } ], @@ -754,7 +824,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 35, "metadata": { "collapsed": false, "scrolled": true @@ -764,7 +834,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "100 loops, best of 3: 3.64 ms per loop\n" + "100 loops, best of 3: 4.14 ms per loop\n" ] } ], @@ -773,6 +843,228 @@ "len(reachable_in('rash', 10, trim_extras=True))" ] }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "2188" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(reachable_in('stay', 10))" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "2193" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(reachable_in('coax', 10))" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "280" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "stay5 = reachable_in('stay', 4)\n", + "len(stay5)" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "296" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "extras = set()\n", + "for w in stay5:\n", + " extras.update(neighbours[w])\n", + "extras.difference_update(stay5)\n", + "len(extras)" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'leak drab twin glib yell jets heed prep dram step grey keep sacs hock bloc bees hews bend chit sots rent knit brat bobs news gram boot baas grad beet door keen toot mewl plus dial bows jeep boom aloe fret need foul beep brew peek veep poop blue weep akin coop lead foot deed hoot teem quit chop teed bias moor sack atop went bier vets teen pout eery leaf drag belt crag peed czar gees veil whip bout jock wees twit beck boos tell vial pees brag tout sped weed geed load book crop text deem shes mead mock very sewn feet sows cell leis dell hemp week yens than mean send chin sill reek wiry knot reed crew peps pest stem melt room coup yews dock less suck boon clef emit bras loot boob pegs pews bran thin well geek boss term pled whir feed whom rock foam dent glue mews rood goat next sort tens goop stay soft perk troy held meet fees best lees reel gent nest brow spec fest coat leek sues pier moot knob test bogs boys said heft hell flee thaw clue prom self felt hair shoe airs cent whet pock gets pent sics pelt bent club berm saws pets blur prod bops whim sick bell trap lets herd help chip loan sued pens dyer peep peel dual sits suet flue goad toad brad peck moan fell cock been whit lens leap omit wets char crow gout frog shoo nets fist root prim lean jell trig coot flea prop meek beef loam bolt chow skid chew crab floe yeps moat tram vent bets jeez soil soon yous unit newt lock bled deep fled tent tees poor heel grab skis rend lent draw know grow doer yock pert legs'" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "' '.join(extras)" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "['coax', 'coat', 'boat', 'boar', 'soar', 'star', 'stay']" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "astar_search('coax', 'stay')" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CPU times: user 2.35 s, sys: 0 ns, total: 2.35 s\n", + "Wall time: 2.35 s\n" + ] + }, + { + "data": { + "text/plain": [ + "['coax', 'coat', 'chat', 'shat', 'slat', 'slay', 'stay']" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "%time bfs_search_closed('coax', 'stay')" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "# %time bfs_search('coax', 'stay')" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "['czar', 'tzar', 'tear', 'sear', 'star', 'stay']" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "astar_search('czar', 'stay')" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "# %time bfs_search('czar', 'stay')" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "# %time bfs_search('coax', 'stay')" + ] + }, { "cell_type": "code", "execution_count": null,