game_icons 0.37.0.20161128 → 0.38.0.20170414
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +18 -18
- data/CHANGELOG.md +3 -0
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +69 -69
- data/Rakefile +20 -20
- data/game_icons.gemspec +34 -34
- data/lib/game_icons.rb +14 -14
- data/lib/game_icons/did_you_mean.rb +65 -65
- data/lib/game_icons/tasks/sanity_test.rb +25 -25
- data/lib/game_icons/tasks/update.rb +30 -30
- data/lib/game_icons/version.rb +7 -7
- data/resources/UPDATING.md +5 -5
- data/resources/icons/cathelineau/originals/svg/medusa-head.svg +1 -0
- data/resources/icons/cathelineau/originals/svg/occupy.svg +1 -0
- data/resources/icons/cathelineau/originals/svg/transparent-slime.svg +1 -0
- data/resources/icons/delapouite/dice/svg/perspective-dice-five.svg +1 -0
- data/resources/icons/delapouite/dice/svg/perspective-dice-four.svg +1 -0
- data/resources/icons/delapouite/dice/svg/perspective-dice-one.svg +1 -0
- data/resources/icons/delapouite/dice/svg/perspective-dice-six.svg +1 -0
- data/resources/icons/delapouite/dice/svg/perspective-dice-three.svg +1 -0
- data/resources/icons/delapouite/dice/svg/perspective-dice-two.svg +1 -0
- data/resources/icons/delapouite/dice/svg/rolling-dice-cup.svg +1 -0
- data/resources/icons/delapouite/originals/svg/3d-stairs.svg +1 -0
- data/resources/icons/delapouite/originals/svg/abacus.svg +1 -0
- data/resources/icons/delapouite/originals/svg/achilles-heel.svg +1 -0
- data/resources/icons/delapouite/originals/svg/airtight-hatch.svg +1 -0
- data/resources/icons/delapouite/originals/svg/alien-bug.svg +1 -0
- data/resources/icons/delapouite/originals/svg/alien-egg.svg +1 -0
- data/resources/icons/delapouite/originals/svg/antibody.svg +1 -0
- data/resources/icons/delapouite/originals/svg/arabic-door.svg +1 -0
- data/resources/icons/delapouite/originals/svg/armadillo.svg +1 -0
- data/resources/icons/delapouite/originals/svg/arrest.svg +1 -0
- data/resources/icons/delapouite/originals/svg/baby-face.svg +1 -0
- data/resources/icons/delapouite/originals/svg/bad-breath.svg +1 -0
- data/resources/icons/delapouite/originals/svg/barracks-tent.svg +1 -0
- data/resources/icons/delapouite/originals/svg/barracks.svg +1 -0
- data/resources/icons/delapouite/originals/svg/beet.svg +1 -0
- data/resources/icons/delapouite/originals/svg/belt-armor.svg +1 -0
- data/resources/icons/delapouite/originals/svg/boat-propeller.svg +1 -0
- data/resources/icons/delapouite/originals/svg/bolivia.svg +1 -0
- data/resources/icons/delapouite/originals/svg/bolt-cutter.svg +1 -0
- data/resources/icons/delapouite/originals/svg/bow-arrow.svg +1 -0
- data/resources/icons/delapouite/originals/svg/bowels.svg +1 -0
- data/resources/icons/delapouite/originals/svg/box-cutter.svg +1 -0
- data/resources/icons/delapouite/originals/svg/brick-wall.svg +1 -1
- data/resources/icons/delapouite/originals/svg/broken-wall.svg +1 -0
- data/resources/icons/delapouite/originals/svg/buy-card.svg +1 -0
- data/resources/icons/delapouite/originals/svg/cadillac-helm.svg +1 -0
- data/resources/icons/delapouite/originals/svg/calavera.svg +1 -0
- data/resources/icons/delapouite/originals/svg/cambodia.svg +1 -0
- data/resources/icons/delapouite/originals/svg/canoe.svg +1 -0
- data/resources/icons/delapouite/originals/svg/caravan.svg +1 -0
- data/resources/icons/delapouite/originals/svg/card-burn.svg +1 -0
- data/resources/icons/delapouite/originals/svg/carnival-mask.svg +1 -0
- data/resources/icons/delapouite/originals/svg/ceiling-light.svg +1 -0
- data/resources/icons/delapouite/originals/svg/chalk-outline-murder.svg +1 -0
- data/resources/icons/delapouite/originals/svg/cherish.svg +1 -0
- data/resources/icons/delapouite/originals/svg/chili-pepper.svg +1 -0
- data/resources/icons/delapouite/originals/svg/cigar.svg +1 -0
- data/resources/icons/delapouite/originals/svg/clownfish.svg +1 -0
- data/resources/icons/delapouite/originals/svg/companion-cube.svg +1 -0
- data/resources/icons/delapouite/originals/svg/coronation.svg +1 -0
- data/resources/icons/delapouite/originals/svg/cotton-flower.svg +1 -0
- data/resources/icons/delapouite/originals/svg/covered-jar.svg +1 -0
- data/resources/icons/delapouite/originals/svg/crane.svg +1 -0
- data/resources/icons/delapouite/originals/svg/crime-scene-tape.svg +1 -0
- data/resources/icons/delapouite/originals/svg/cross-shield.svg +1 -0
- data/resources/icons/delapouite/originals/svg/crystal-shrine.svg +1 -0
- data/resources/icons/delapouite/originals/svg/cube.svg +1 -0
- data/resources/icons/delapouite/originals/svg/cyborg-face.svg +1 -0
- data/resources/icons/delapouite/originals/svg/defense-satellite.svg +1 -0
- data/resources/icons/delapouite/originals/svg/diamond-hilt.svg +1 -0
- data/resources/icons/delapouite/originals/svg/director-chair.svg +1 -0
- data/resources/icons/delapouite/originals/svg/drawbridge.svg +1 -0
- data/resources/icons/delapouite/originals/svg/dungeon-gate.svg +1 -0
- data/resources/icons/delapouite/originals/svg/dutch-bike.svg +1 -0
- data/resources/icons/delapouite/originals/svg/ecology.svg +1 -0
- data/resources/icons/delapouite/originals/svg/egypt.svg +1 -0
- data/resources/icons/delapouite/originals/svg/elephant.svg +1 -0
- data/resources/icons/delapouite/originals/svg/encirclement.svg +1 -0
- data/resources/icons/delapouite/originals/svg/eternal-love.svg +1 -0
- data/resources/icons/delapouite/originals/svg/expense.svg +1 -0
- data/resources/icons/delapouite/originals/svg/farm-tractor.svg +1 -0
- data/resources/icons/delapouite/originals/svg/files.svg +1 -0
- data/resources/icons/delapouite/originals/svg/film-projector.svg +1 -0
- data/resources/icons/delapouite/originals/svg/fish-monster.svg +1 -0
- data/resources/icons/delapouite/originals/svg/fishing-spoon.svg +1 -0
- data/resources/icons/delapouite/originals/svg/flamingo.svg +1 -0
- data/resources/icons/delapouite/originals/svg/flip-flops.svg +1 -0
- data/resources/icons/delapouite/originals/svg/flower-star.svg +1 -0
- data/resources/icons/delapouite/originals/svg/fly.svg +1 -0
- data/resources/icons/delapouite/originals/svg/fruit-tree.svg +1 -0
- data/resources/icons/delapouite/originals/svg/full-folder.svg +1 -0
- data/resources/icons/delapouite/originals/svg/funnel.svg +1 -0
- data/resources/icons/delapouite/originals/svg/game-console.svg +1 -0
- data/resources/icons/delapouite/originals/svg/giant-squid.svg +1 -0
- data/resources/icons/delapouite/originals/svg/glass-celebration.svg +1 -0
- data/resources/icons/delapouite/originals/svg/globe-ring.svg +1 -0
- data/resources/icons/delapouite/originals/svg/goblin-camp.svg +1 -0
- data/resources/icons/delapouite/originals/svg/goblin-head.svg +1 -0
- data/resources/icons/delapouite/originals/svg/gold-nuggets.svg +1 -0
- data/resources/icons/delapouite/originals/svg/gorilla.svg +1 -0
- data/resources/icons/delapouite/originals/svg/griffin-symbol.svg +1 -0
- data/resources/icons/delapouite/originals/svg/habitat-dome.svg +1 -0
- data/resources/icons/delapouite/originals/svg/hamburger.svg +1 -0
- data/resources/icons/delapouite/originals/svg/handcuffed.svg +1 -0
- data/resources/icons/delapouite/originals/svg/hanger.svg +1 -0
- data/resources/icons/delapouite/originals/svg/hazmat-suit.svg +1 -0
- data/resources/icons/delapouite/originals/svg/headband-knot.svg +1 -0
- data/resources/icons/delapouite/originals/svg/hemp.svg +1 -0
- data/resources/icons/delapouite/originals/svg/heptagram.svg +1 -0
- data/resources/icons/delapouite/originals/svg/high-kick.svg +1 -0
- data/resources/icons/delapouite/originals/svg/home-garage.svg +1 -0
- data/resources/icons/delapouite/originals/svg/hops.svg +1 -0
- data/resources/icons/delapouite/originals/svg/ice-skate.svg +1 -0
- data/resources/icons/delapouite/originals/svg/italia.svg +1 -0
- data/resources/icons/delapouite/originals/svg/ivory-tusks.svg +1 -0
- data/resources/icons/delapouite/originals/svg/jack-plug.svg +1 -0
- data/resources/icons/delapouite/originals/svg/jason-mask.svg +1 -0
- data/resources/icons/delapouite/originals/svg/king-ju-mask.svg +1 -0
- data/resources/icons/delapouite/originals/svg/kiwi-bird.svg +1 -0
- data/resources/icons/delapouite/originals/svg/knee-pad.svg +1 -0
- data/resources/icons/delapouite/originals/svg/large-paint-brush.svg +1 -0
- data/resources/icons/delapouite/originals/svg/laser-turret.svg +1 -0
- data/resources/icons/delapouite/originals/svg/laurels-trophy.svg +1 -0
- data/resources/icons/delapouite/originals/svg/leg-armor.svg +1 -0
- data/resources/icons/delapouite/originals/svg/liver.svg +1 -0
- data/resources/icons/delapouite/originals/svg/locked-heart.svg +1 -0
- data/resources/icons/delapouite/originals/svg/loincloth.svg +1 -0
- data/resources/icons/delapouite/originals/svg/love-letter.svg +1 -0
- data/resources/icons/delapouite/originals/svg/love-mystery.svg +1 -0
- data/resources/icons/delapouite/originals/svg/lovers.svg +1 -0
- data/resources/icons/delapouite/originals/svg/manta-ray.svg +1 -0
- data/resources/icons/delapouite/originals/svg/mars-curiosity.svg +1 -0
- data/resources/icons/delapouite/originals/svg/mars-pathfinder.svg +1 -0
- data/resources/icons/delapouite/originals/svg/mechanic-garage.svg +1 -0
- data/resources/icons/delapouite/originals/svg/mermaid.svg +1 -0
- data/resources/icons/delapouite/originals/svg/military-fort.svg +1 -0
- data/resources/icons/delapouite/originals/svg/mini-submarine.svg +1 -0
- data/resources/icons/delapouite/originals/svg/mining-helmet.svg +1 -0
- data/resources/icons/delapouite/originals/svg/missile-launcher.svg +1 -0
- data/resources/icons/delapouite/originals/svg/modern-city.svg +1 -0
- data/resources/icons/delapouite/originals/svg/mono-wheel-robot.svg +1 -0
- data/resources/icons/delapouite/originals/svg/morgue-feet.svg +1 -0
- data/resources/icons/delapouite/originals/svg/mug-shot.svg +1 -0
- data/resources/icons/delapouite/originals/svg/mushroom-house.svg +1 -0
- data/resources/icons/delapouite/originals/svg/ninja-armor.svg +1 -0
- data/resources/icons/delapouite/originals/svg/oil-pump.svg +1 -0
- data/resources/icons/delapouite/originals/svg/open-folder.svg +1 -0
- data/resources/icons/delapouite/originals/svg/opened-food-can.svg +1 -0
- data/resources/icons/delapouite/originals/svg/paint-brush.svg +1 -0
- data/resources/icons/delapouite/originals/svg/painted-pottery.svg +1 -0
- data/resources/icons/delapouite/originals/svg/path-tile.svg +1 -0
- data/resources/icons/delapouite/originals/svg/pearl-necklace.svg +1 -0
- data/resources/icons/delapouite/originals/svg/pelvis-bone.svg +1 -0
- data/resources/icons/delapouite/originals/svg/penguin.svg +1 -0
- data/resources/icons/delapouite/originals/svg/person.svg +1 -0
- data/resources/icons/delapouite/originals/svg/pirate-captain.svg +1 -0
- data/resources/icons/delapouite/originals/svg/pirate-flag.svg +1 -0
- data/resources/icons/delapouite/originals/svg/pisa-tower.svg +1 -0
- data/resources/icons/delapouite/originals/svg/pocket-radio.svg +1 -0
- data/resources/icons/delapouite/originals/svg/podium-second.svg +1 -0
- data/resources/icons/delapouite/originals/svg/podium-third.svg +1 -0
- data/resources/icons/delapouite/originals/svg/podium-winner.svg +1 -0
- data/resources/icons/delapouite/originals/svg/pool-dive.svg +1 -0
- data/resources/icons/delapouite/originals/svg/porcelain-vase.svg +1 -0
- data/resources/icons/delapouite/originals/svg/potato.svg +1 -0
- data/resources/icons/delapouite/originals/svg/powder-bag.svg +1 -0
- data/resources/icons/delapouite/originals/svg/power-generator.svg +1 -0
- data/resources/icons/delapouite/originals/svg/radio-tower.svg +1 -0
- data/resources/icons/delapouite/originals/svg/resize.svg +1 -0
- data/resources/icons/delapouite/originals/svg/ringing-alarm.svg +1 -0
- data/resources/icons/delapouite/originals/svg/robot-antennas.svg +1 -0
- data/resources/icons/delapouite/originals/svg/rolled-cloth.svg +1 -0
- data/resources/icons/delapouite/originals/svg/round-silo.svg +1 -0
- data/resources/icons/delapouite/originals/svg/saint-basil-cathedral.svg +1 -0
- data/resources/icons/delapouite/originals/svg/saiyan-suit.svg +1 -0
- data/resources/icons/delapouite/originals/svg/sand-castle.svg +1 -0
- data/resources/icons/delapouite/originals/svg/sarcophagus.svg +1 -0
- data/resources/icons/delapouite/originals/svg/saxophone.svg +1 -0
- data/resources/icons/delapouite/originals/svg/scuba-tanks.svg +1 -0
- data/resources/icons/delapouite/originals/svg/secret-door.svg +1 -0
- data/resources/icons/delapouite/originals/svg/sell-card.svg +1 -0
- data/resources/icons/delapouite/originals/svg/sherlock-holmes.svg +1 -0
- data/resources/icons/delapouite/originals/svg/shoulder-armor.svg +1 -0
- data/resources/icons/delapouite/originals/svg/sinking-ship.svg +1 -0
- data/resources/icons/delapouite/originals/svg/ski-boot.svg +1 -0
- data/resources/icons/delapouite/originals/svg/slime.svg +1 -0
- data/resources/icons/delapouite/originals/svg/sofa.svg +1 -0
- data/resources/icons/delapouite/originals/svg/sound-off.svg +1 -0
- data/resources/icons/delapouite/originals/svg/sound-on.svg +1 -0
- data/resources/icons/delapouite/originals/svg/spaceship.svg +1 -0
- data/resources/icons/delapouite/originals/svg/spain.svg +1 -0
- data/resources/icons/delapouite/originals/svg/spell-book.svg +1 -0
- data/resources/icons/delapouite/originals/svg/spiked-trunk.svg +1 -0
- data/resources/icons/delapouite/originals/svg/spiral-hilt.svg +1 -0
- data/resources/icons/delapouite/originals/svg/squirrel.svg +1 -0
- data/resources/icons/delapouite/originals/svg/stabbed-note.svg +1 -0
- data/resources/icons/delapouite/originals/svg/star-formation.svg +1 -0
- data/resources/icons/delapouite/originals/svg/starfighter.svg +1 -0
- data/resources/icons/delapouite/originals/svg/steam.svg +1 -0
- data/resources/icons/delapouite/originals/svg/stone-bust.svg +1 -0
- data/resources/icons/delapouite/originals/svg/stork-delivery.svg +1 -0
- data/resources/icons/delapouite/originals/svg/stump-regrowth.svg +1 -0
- data/resources/icons/delapouite/originals/svg/sugar-cane.svg +1 -0
- data/resources/icons/delapouite/originals/svg/sunrise.svg +1 -0
- data/resources/icons/delapouite/originals/svg/sunset.svg +1 -0
- data/resources/icons/delapouite/originals/svg/swimfins.svg +1 -0
- data/resources/icons/delapouite/originals/svg/swiss-army-knife.svg +1 -0
- data/resources/icons/delapouite/originals/svg/thrust-bend.svg +1 -0
- data/resources/icons/delapouite/originals/svg/tire-tracks.svg +1 -0
- data/resources/icons/delapouite/originals/svg/tongue.svg +1 -0
- data/resources/icons/delapouite/originals/svg/tracked-robot.svg +1 -0
- data/resources/icons/delapouite/originals/svg/two-handed-sword.svg +1 -0
- data/resources/icons/delapouite/originals/svg/up-card.svg +1 -0
- data/resources/icons/delapouite/originals/svg/vampire-cape.svg +1 -0
- data/resources/icons/delapouite/originals/svg/vampire-dracula.svg +1 -0
- data/resources/icons/delapouite/originals/svg/video-camera.svg +1 -0
- data/resources/icons/delapouite/originals/svg/vitruvian-man.svg +1 -0
- data/resources/icons/delapouite/originals/svg/walking-scout.svg +1 -0
- data/resources/icons/delapouite/originals/svg/war-pick.svg +1 -0
- data/resources/icons/delapouite/originals/svg/warlock-hood.svg +1 -0
- data/resources/icons/delapouite/originals/svg/wax-tablet.svg +1 -0
- data/resources/icons/delapouite/originals/svg/whale-tail.svg +1 -0
- data/resources/icons/delapouite/originals/svg/wine-bottle.svg +1 -0
- data/resources/icons/delapouite/originals/svg/wooden-pier.svg +1 -0
- data/resources/icons/delapouite/originals/svg/wool.svg +1 -0
- data/resources/icons/delapouite/western/svg/cactus.svg +0 -0
- data/resources/icons/delapouite/western/svg/lasso.svg +0 -0
- data/resources/icons/kier-heyl/originals/svg/dwarf-king.svg +1 -0
- data/resources/icons/kier-heyl/originals/svg/elf-helmet.svg +1 -0
- data/resources/icons/license.txt +3 -0
- data/resources/icons/lorc/originals/svg/ball-glow.svg +1 -0
- data/resources/icons/lorc/originals/svg/bolt-eye.svg +1 -0
- data/resources/icons/lorc/originals/svg/cracked-alien-skull.svg +1 -0
- data/resources/icons/lorc/originals/svg/cross-flare.svg +1 -0
- data/resources/icons/lorc/originals/svg/curly-mask.svg +1 -0
- data/resources/icons/lorc/originals/svg/dorsal-scales.svg +1 -0
- data/resources/icons/lorc/originals/svg/double-ringed-orb.svg +1 -0
- data/resources/icons/lorc/originals/svg/entangled-typhoon.svg +1 -0
- data/resources/icons/lorc/originals/svg/evil-bud.svg +1 -0
- data/resources/icons/lorc/originals/svg/evil-comet.svg +1 -0
- data/resources/icons/lorc/originals/svg/ghost-ally.svg +1 -0
- data/resources/icons/lorc/originals/svg/lightning-spanner.svg +1 -0
- data/resources/icons/lorc/originals/svg/octoman.svg +1 -0
- data/resources/icons/lorc/originals/svg/orbital-rays.svg +1 -0
- data/resources/icons/lorc/originals/svg/rolling-energy.svg +1 -0
- data/resources/icons/lorc/originals/svg/sewed-shell.svg +1 -0
- data/resources/icons/lorc/originals/svg/smoking-orb.svg +1 -0
- data/resources/icons/lorc/originals/svg/striped-sword.svg +1 -0
- data/resources/icons/lorc/originals/svg/surrounded-eye.svg +1 -0
- data/resources/icons/lorc/originals/svg/surrounded-shield.svg +1 -0
- data/resources/icons/lorc/originals/svg/swords-emblem.svg +1 -0
- data/resources/icons/lorc/originals/svg/templar-eye.svg +1 -0
- data/resources/icons/lorc/originals/svg/totem-mask.svg +1 -0
- data/resources/icons/lorc/originals/svg/triple-shells.svg +1 -0
- data/resources/icons/lorc/originals/svg/william-tell-skull.svg +1 -0
- data/resources/icons/quoting/originals/svg/artillery-shell.svg +1 -0
- data/resources/icons/quoting/originals/svg/biplane.svg +1 -0
- data/resources/icons/quoting/originals/svg/bunker-assault.svg +1 -0
- data/resources/icons/quoting/originals/svg/bunker.svg +1 -0
- data/resources/icons/quoting/originals/svg/card-pickup.svg +1 -0
- data/resources/icons/quoting/originals/svg/card-play.svg +1 -0
- data/resources/icons/quoting/originals/svg/damaged-house.svg +1 -0
- data/resources/icons/quoting/originals/svg/field-gun.svg +1 -0
- data/resources/icons/quoting/originals/svg/lost-limb.svg +1 -0
- data/resources/icons/quoting/originals/svg/military-ambulance.svg +1 -0
- data/resources/icons/quoting/originals/svg/poppy.svg +1 -0
- data/resources/icons/quoting/originals/svg/trench-assault.svg +1 -0
- data/resources/icons/rihlsul/originals/svg/chocolate-bar.svg +1 -0
- data/resources/icons/rihlsul/originals/svg/milk-carton.svg +1 -0
- data/resources/icons/rihlsul/originals/svg/peanut.svg +1 -0
- data/resources/icons/skoll/originals/svg/bat.svg +1 -0
- data/resources/icons/skoll/originals/svg/burning-skull.svg +1 -0
- data/resources/icons/skoll/originals/svg/butterfly-knife.svg +1 -0
- data/resources/icons/skoll/originals/svg/colt-m1911.svg +1 -0
- data/resources/icons/skoll/originals/svg/f1-car.svg +1 -0
- data/resources/icons/skoll/originals/svg/fn-fal.svg +1 -0
- data/resources/icons/skoll/originals/svg/glock.svg +1 -0
- data/resources/icons/skoll/originals/svg/hang-glider.svg +1 -0
- data/resources/icons/skoll/originals/svg/inverted-dice-1.svg +1 -0
- data/resources/icons/skoll/originals/svg/inverted-dice-2.svg +1 -0
- data/resources/icons/skoll/originals/svg/inverted-dice-3.svg +1 -0
- data/resources/icons/skoll/originals/svg/inverted-dice-4.svg +1 -0
- data/resources/icons/skoll/originals/svg/inverted-dice-5.svg +1 -0
- data/resources/icons/skoll/originals/svg/inverted-dice-6.svg +1 -0
- data/resources/icons/skoll/originals/svg/m3-grease-gun.svg +1 -0
- data/resources/icons/skoll/originals/svg/mac-10.svg +1 -0
- data/resources/icons/skoll/originals/svg/mp5k.svg +1 -0
- data/resources/icons/skoll/originals/svg/revolver.svg +1 -0
- data/resources/icons/skoll/originals/svg/spectre-m4.svg +1 -0
- data/resources/icons/skoll/originals/svg/spiked-ball.svg +1 -0
- data/resources/icons/skoll/originals/svg/spiked-bat.svg +1 -0
- data/resources/icons/skoll/originals/svg/stiletto.svg +1 -0
- data/resources/icons/skoll/originals/svg/switchblade.svg +1 -0
- data/resources/icons/skoll/originals/svg/tec-9.svg +1 -0
- data/resources/icons/skoll/originals/svg/telescopic-baton.svg +1 -0
- data/resources/icons/skoll/originals/svg/teller-mine.svg +1 -0
- data/resources/icons/skoll/originals/svg/thompson-m1.svg +1 -0
- data/resources/icons/skoll/originals/svg/thompson-m1928.svg +1 -0
- data/resources/icons/skoll/originals/svg/trench-knife.svg +1 -0
- data/resources/icons/skoll/originals/svg/winchester-rifle.svg +1 -0
- data/resources/icons/sparker/originals/svg/bear-face.svg +1 -1
- data/resources/icons/zeromancer/deviations/svg/heart-minus.svg +1 -0
- data/resources/icons/zeromancer/deviations/svg/heart-plus.svg +1 -0
- data/spec/data/glass-heart-corrected.svg +1 -1
- data/spec/did_you_mean_spec.rb +104 -104
- metadata +291 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffce02dac27129fc88b599b6a94b10dc6bd90f77
|
4
|
+
data.tar.gz: 6c15bea889136d56286acc7f6431147bcb23998a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55ad3488a26d0528cbb1558e8e4df3e320fdee325916b51a45ef1f1d4fb2521ddba83b142ca91fe74beea6b24bae63da9ce96a0f9dc37ce2045bf5f8447ed913
|
7
|
+
data.tar.gz: 0fd0bdd9b6d1f0e3e71c86aa9284d1969d99c37d6b4a02cc1f45ec71678545e8b80a92168ce61b746d9ad7f4821916c59e11e30c1decd104b077edef4787fe60
|
data/.gitignore
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/Gemfile.lock
|
4
|
-
/_yardoc/
|
5
|
-
/coverage/
|
6
|
-
/doc/
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/tmp/
|
10
|
-
*.bundle
|
11
|
-
*.so
|
12
|
-
*.o
|
13
|
-
*.a
|
14
|
-
mkmf.log
|
15
|
-
.DS_Store
|
16
|
-
sanity_test.png
|
17
|
-
game-icons.net.svg.zip
|
18
|
-
.byebug_history
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
*.bundle
|
11
|
+
*.so
|
12
|
+
*.o
|
13
|
+
*.a
|
14
|
+
mkmf.log
|
15
|
+
.DS_Store
|
16
|
+
sanity_test.png
|
17
|
+
game-icons.net.svg.zip
|
18
|
+
.byebug_history
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,9 @@ This gem follows [semantic versioning](http://semver.org), with the date of the
|
|
4
4
|
|
5
5
|
e.g. "0.1.0.20150413.alpha" has the April 13, 2015 release of game-icons.net
|
6
6
|
|
7
|
+
## v0.38.0 / 2017-04-14
|
8
|
+
* Update to latest icons
|
9
|
+
|
7
10
|
## v0.37.0 / 2016-11-28
|
8
11
|
* Update for Nov 28 icons
|
9
12
|
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in game_icons.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in game_icons.gemspec
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2015 Andy Meneely
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2015 Andy Meneely
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,69 +1,69 @@
|
|
1
|
-
# Game Icons [](https://rubygems.org/gems/game_icons) [](https://travis-ci.org/andymeneely/game_icons) [](https://gemnasium.com/andymeneely/game_icons) [](https://coveralls.io/r/andymeneely/game_icons)
|
2
|
-
|
3
|
-
RubyGem access to the SVGs on [game-icons.net](http://game-icons.net), an awesome library of free icons.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'game_icons'
|
11
|
-
```
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install game_icons
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
require 'game_icons'
|
25
|
-
|
26
|
-
GameIcons.get('glass-heart').file # absolute path to glass-heart.svg, white-on-black
|
27
|
-
GameIcons.get('glass-heart.svg').file # .svg extension allowed too
|
28
|
-
GameIcons.get(:flame).file # symbols work too
|
29
|
-
GameIcons.get('glass-heart').string # the SVG string
|
30
|
-
GameIcons.get('glass-heart').string # the SVG string
|
31
|
-
GameIcons.get('glass-heart').recolor(fg: '333', bg: 'ccc').string # recolor the foreground and background to different shades of gray
|
32
|
-
GameIcons.get('glass-heart').recolor(fg: '333', bg: 'ccc', fg_opacity: 0.25, bg_opacity: 0.75).string # recolor with opacity c
|
33
|
-
|
34
|
-
GameIcons.names # returns an array of all names
|
35
|
-
GameIcons.get('skoll/jeep') # Add author name to disambiguate names
|
36
|
-
GameIcons.get('delapouite/jeep') # Add author name to disambiguate names
|
37
|
-
GameIcons.get('jeep') # Behavior undefined for ambiguous names
|
38
|
-
```
|
39
|
-
|
40
|
-
## Working With Squib
|
41
|
-
|
42
|
-
[Squib](http://andymeneely.github.io/squib) is my other pet project. Here's some example usage:
|
43
|
-
|
44
|
-
```ruby
|
45
|
-
require 'game_icons' # Be sure to also put this in your Gemfile and run "bundle install"
|
46
|
-
require 'squib'
|
47
|
-
|
48
|
-
Squib::Deck.new do
|
49
|
-
#You can access just the file
|
50
|
-
svg file: GameIcons.get('glass-heart').file
|
51
|
-
#Or you can get the data as a string
|
52
|
-
svg data: GameIcons.get('glass-heart').string
|
53
|
-
svg data: GameIcons.get('glass-heart').recolor(fg: '333', bg: 'ccc').string
|
54
|
-
end
|
55
|
-
```
|
56
|
-
|
57
|
-
## We Are Not Game-Icons.net
|
58
|
-
|
59
|
-
This is not affiliated with [game-icons.net](http://game-icons.net). They are awesome, talented artists who give away their hard work. I'm not them.
|
60
|
-
|
61
|
-
That said, the Ruby code surroudning this Gem is MIT licensed. The icons themselves are under a [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/). Be sure to attribute them in your work.
|
62
|
-
|
63
|
-
## Contributing
|
64
|
-
|
65
|
-
1. Fork it ( https://github.com/[my-github-username]/game_icons/fork )
|
66
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
67
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
68
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
69
|
-
5. Create a new Pull Request
|
1
|
+
# Game Icons [](https://rubygems.org/gems/game_icons) [](https://travis-ci.org/andymeneely/game_icons) [](https://gemnasium.com/andymeneely/game_icons) [](https://coveralls.io/r/andymeneely/game_icons)
|
2
|
+
|
3
|
+
RubyGem access to the SVGs on [game-icons.net](http://game-icons.net), an awesome library of free icons.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'game_icons'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install game_icons
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'game_icons'
|
25
|
+
|
26
|
+
GameIcons.get('glass-heart').file # absolute path to glass-heart.svg, white-on-black
|
27
|
+
GameIcons.get('glass-heart.svg').file # .svg extension allowed too
|
28
|
+
GameIcons.get(:flame).file # symbols work too
|
29
|
+
GameIcons.get('glass-heart').string # the SVG string
|
30
|
+
GameIcons.get('glass-heart').string # the SVG string
|
31
|
+
GameIcons.get('glass-heart').recolor(fg: '333', bg: 'ccc').string # recolor the foreground and background to different shades of gray
|
32
|
+
GameIcons.get('glass-heart').recolor(fg: '333', bg: 'ccc', fg_opacity: 0.25, bg_opacity: 0.75).string # recolor with opacity c
|
33
|
+
|
34
|
+
GameIcons.names # returns an array of all names
|
35
|
+
GameIcons.get('skoll/jeep') # Add author name to disambiguate names
|
36
|
+
GameIcons.get('delapouite/jeep') # Add author name to disambiguate names
|
37
|
+
GameIcons.get('jeep') # Behavior undefined for ambiguous names
|
38
|
+
```
|
39
|
+
|
40
|
+
## Working With Squib
|
41
|
+
|
42
|
+
[Squib](http://andymeneely.github.io/squib) is my other pet project. Here's some example usage:
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
require 'game_icons' # Be sure to also put this in your Gemfile and run "bundle install"
|
46
|
+
require 'squib'
|
47
|
+
|
48
|
+
Squib::Deck.new do
|
49
|
+
#You can access just the file
|
50
|
+
svg file: GameIcons.get('glass-heart').file
|
51
|
+
#Or you can get the data as a string
|
52
|
+
svg data: GameIcons.get('glass-heart').string
|
53
|
+
svg data: GameIcons.get('glass-heart').recolor(fg: '333', bg: 'ccc').string
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
## We Are Not Game-Icons.net
|
58
|
+
|
59
|
+
This is not affiliated with [game-icons.net](http://game-icons.net). They are awesome, talented artists who give away their hard work. I'm not them.
|
60
|
+
|
61
|
+
That said, the Ruby code surroudning this Gem is MIT licensed. The icons themselves are under a [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/). Be sure to attribute them in your work.
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
1. Fork it ( https://github.com/[my-github-username]/game_icons/fork )
|
66
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
67
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
68
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
69
|
+
5. Create a new Pull Request
|
data/Rakefile
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
require 'launchy'
|
4
|
-
|
5
|
-
task default: [:install, :spec]
|
6
|
-
|
7
|
-
RSpec::Core::RakeTask.new(:spec)
|
8
|
-
|
9
|
-
desc 'Stitch and recolor every icon into a giant sheet'
|
10
|
-
task :sanity => :install do
|
11
|
-
require 'game_icons/tasks/sanity_test'
|
12
|
-
GameIcons::SanityTest.run
|
13
|
-
Launchy.open("file:///" + File.expand_path('./sanity_test.png', File.dirname(__FILE__)))
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'Download and unzip the latest icons'
|
17
|
-
task :update do
|
18
|
-
require 'game_icons/tasks/update'
|
19
|
-
GameIcons::Update.run
|
20
|
-
end
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'launchy'
|
4
|
+
|
5
|
+
task default: [:install, :spec]
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
|
9
|
+
desc 'Stitch and recolor every icon into a giant sheet'
|
10
|
+
task :sanity => :install do
|
11
|
+
require 'game_icons/tasks/sanity_test'
|
12
|
+
GameIcons::SanityTest.run
|
13
|
+
Launchy.open("file:///" + File.expand_path('./sanity_test.png', File.dirname(__FILE__)))
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Download and unzip the latest icons'
|
17
|
+
task :update do
|
18
|
+
require 'game_icons/tasks/update'
|
19
|
+
GameIcons::Update.run
|
20
|
+
end
|
data/game_icons.gemspec
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'game_icons/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.specification_version = 2 if spec.respond_to? :specification_version=
|
8
|
-
spec.required_rubygems_version = Gem::Requirement.new('>= 0') if spec.respond_to? :required_rubygems_version=
|
9
|
-
spec.required_ruby_version = '>= 2.0.0'
|
10
|
-
|
11
|
-
spec.name = "game_icons"
|
12
|
-
spec.version = GameIcons::VERSION
|
13
|
-
spec.authors = ["Andy Meneely"]
|
14
|
-
spec.email = ["andy.meneely@gmail.com"]
|
15
|
-
spec.summary = %q{Icons from game-icons.net}
|
16
|
-
spec.description = %q{Access and manipulate the scalable, free icons of game-icons.net}
|
17
|
-
spec.homepage = "https://github.com/andymeneely/game_icons"
|
18
|
-
spec.license = "MIT"
|
19
|
-
|
20
|
-
spec.files = `git ls-files -z`.split("\x0")
|
21
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
|
-
spec.require_paths = ["lib"]
|
24
|
-
|
25
|
-
spec.add_development_dependency "bundler", "~> 1.7"
|
26
|
-
spec.add_development_dependency "rake"
|
27
|
-
spec.add_development_dependency 'rspec', '~> 3.2'
|
28
|
-
spec.add_development_dependency 'coveralls'
|
29
|
-
spec.add_development_dependency 'nokogiri', '~> 1.6.7'
|
30
|
-
spec.add_development_dependency 'cairo'
|
31
|
-
spec.add_development_dependency 'pango'
|
32
|
-
spec.add_development_dependency 'rsvg2'
|
33
|
-
spec.add_development_dependency 'launchy'
|
34
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'game_icons/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.specification_version = 2 if spec.respond_to? :specification_version=
|
8
|
+
spec.required_rubygems_version = Gem::Requirement.new('>= 0') if spec.respond_to? :required_rubygems_version=
|
9
|
+
spec.required_ruby_version = '>= 2.0.0'
|
10
|
+
|
11
|
+
spec.name = "game_icons"
|
12
|
+
spec.version = GameIcons::VERSION
|
13
|
+
spec.authors = ["Andy Meneely"]
|
14
|
+
spec.email = ["andy.meneely@gmail.com"]
|
15
|
+
spec.summary = %q{Icons from game-icons.net}
|
16
|
+
spec.description = %q{Access and manipulate the scalable, free icons of game-icons.net}
|
17
|
+
spec.homepage = "https://github.com/andymeneely/game_icons"
|
18
|
+
spec.license = "MIT"
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`.split("\x0")
|
21
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.2'
|
28
|
+
spec.add_development_dependency 'coveralls'
|
29
|
+
spec.add_development_dependency 'nokogiri', '~> 1.6.7'
|
30
|
+
spec.add_development_dependency 'cairo'
|
31
|
+
spec.add_development_dependency 'pango'
|
32
|
+
spec.add_development_dependency 'rsvg2'
|
33
|
+
spec.add_development_dependency 'launchy'
|
34
|
+
end
|
data/lib/game_icons.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
require "game_icons/version"
|
2
|
-
require 'game_icons/finder'
|
3
|
-
require 'game_icons/db'
|
4
|
-
require 'game_icons/optional_deps'
|
5
|
-
|
6
|
-
module GameIcons
|
7
|
-
def self.get(name)
|
8
|
-
Finder.new.find(name)
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.names
|
12
|
-
DB.names
|
13
|
-
end
|
14
|
-
end
|
1
|
+
require "game_icons/version"
|
2
|
+
require 'game_icons/finder'
|
3
|
+
require 'game_icons/db'
|
4
|
+
require 'game_icons/optional_deps'
|
5
|
+
|
6
|
+
module GameIcons
|
7
|
+
def self.get(name)
|
8
|
+
Finder.new.find(name)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.names
|
12
|
+
DB.names
|
13
|
+
end
|
14
|
+
end
|
@@ -1,65 +1,65 @@
|
|
1
|
-
require 'game_icons/db'
|
2
|
-
|
3
|
-
module GameIcons
|
4
|
-
class DidYouMean
|
5
|
-
def initialize(names)
|
6
|
-
@letter_freqs = lex(names)
|
7
|
-
end
|
8
|
-
|
9
|
-
def query(q, result_size = 5)
|
10
|
-
q = scrub(q.downcase.strip)
|
11
|
-
q_freq = char_freq(q)
|
12
|
-
scores = Hash.new(0)
|
13
|
-
@letter_freqs.each do |name, freq|
|
14
|
-
scores[name] = score(freq, q_freq)
|
15
|
-
end
|
16
|
-
top(result_size, scores)
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
def lex(names)
|
21
|
-
names.inject({}) do |freqs, name|
|
22
|
-
freqs[name] = char_freq(scrub(name.downcase.strip))
|
23
|
-
freqs
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# Computes a hash of each character
|
28
|
-
def char_freq(str)
|
29
|
-
freqs = Hash.new(0)
|
30
|
-
(1..4).each do |i|
|
31
|
-
str.chars.each_cons(i).inject(freqs) do |freq, ngram|
|
32
|
-
ngram = ngram.join
|
33
|
-
freq[ngram] = freq[ngram] + 1
|
34
|
-
freq
|
35
|
-
end
|
36
|
-
end
|
37
|
-
freqs
|
38
|
-
end
|
39
|
-
|
40
|
-
def scrub(str)
|
41
|
-
str.gsub(/[^a-z]/i, '')
|
42
|
-
end
|
43
|
-
|
44
|
-
def score(n_freq, q_freq)
|
45
|
-
score = 0
|
46
|
-
# Go over every freq in the query
|
47
|
-
|
48
|
-
# q_freq.each do |c, count|
|
49
|
-
# score += (n_freq[c] - count).abs
|
50
|
-
# end
|
51
|
-
# Go over everything in n that was not in query
|
52
|
-
(n_freq.keys + q_freq.keys).uniq.each do |k|
|
53
|
-
score += (n_freq[k] - q_freq[k]).abs
|
54
|
-
end
|
55
|
-
score
|
56
|
-
end
|
57
|
-
|
58
|
-
# Return top scoring, sorted by lowest
|
59
|
-
def top(n, scores)
|
60
|
-
scores.sort {|a,b| a[1] <=> b[1]}.map{|x| x[0]}.first(n)
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
1
|
+
require 'game_icons/db'
|
2
|
+
|
3
|
+
module GameIcons
|
4
|
+
class DidYouMean
|
5
|
+
def initialize(names)
|
6
|
+
@letter_freqs = lex(names)
|
7
|
+
end
|
8
|
+
|
9
|
+
def query(q, result_size = 5)
|
10
|
+
q = scrub(q.downcase.strip)
|
11
|
+
q_freq = char_freq(q)
|
12
|
+
scores = Hash.new(0)
|
13
|
+
@letter_freqs.each do |name, freq|
|
14
|
+
scores[name] = score(freq, q_freq)
|
15
|
+
end
|
16
|
+
top(result_size, scores)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def lex(names)
|
21
|
+
names.inject({}) do |freqs, name|
|
22
|
+
freqs[name] = char_freq(scrub(name.downcase.strip))
|
23
|
+
freqs
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Computes a hash of each character
|
28
|
+
def char_freq(str)
|
29
|
+
freqs = Hash.new(0)
|
30
|
+
(1..4).each do |i|
|
31
|
+
str.chars.each_cons(i).inject(freqs) do |freq, ngram|
|
32
|
+
ngram = ngram.join
|
33
|
+
freq[ngram] = freq[ngram] + 1
|
34
|
+
freq
|
35
|
+
end
|
36
|
+
end
|
37
|
+
freqs
|
38
|
+
end
|
39
|
+
|
40
|
+
def scrub(str)
|
41
|
+
str.gsub(/[^a-z]/i, '')
|
42
|
+
end
|
43
|
+
|
44
|
+
def score(n_freq, q_freq)
|
45
|
+
score = 0
|
46
|
+
# Go over every freq in the query
|
47
|
+
|
48
|
+
# q_freq.each do |c, count|
|
49
|
+
# score += (n_freq[c] - count).abs
|
50
|
+
# end
|
51
|
+
# Go over everything in n that was not in query
|
52
|
+
(n_freq.keys + q_freq.keys).uniq.each do |k|
|
53
|
+
score += (n_freq[k] - q_freq[k]).abs
|
54
|
+
end
|
55
|
+
score
|
56
|
+
end
|
57
|
+
|
58
|
+
# Return top scoring, sorted by lowest
|
59
|
+
def top(n, scores)
|
60
|
+
scores.sort {|a,b| a[1] <=> b[1]}.map{|x| x[0]}.first(n)
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|