Skip to content

Instantly share code, notes, and snippets.

@yuki24
yuki24 / incorrect_corrections.yml
Last active Aug 29, 2015
A list of Incorrect corrections generated by did_you_mean's spell checker
View incorrect_corrections.yml
#- correct_word: incorrect_word(user input)
# result:
# - list_of_candidates
---
- absence: absense
result:
- absences
- absents
- absence
- absentee
@yuki24
yuki24 / calculate_accuracy.rb
Last active Aug 29, 2015
How accurate is the did_you_mean gem?
View calculate_accuracy.rb
# gem 'did_you_mean', '0.9.7'
require 'yaml'
require 'set'
require 'did_you_mean'
class DidYouMean::WordCollection
include DidYouMean::BaseFinder
def initialize(words)
@yuki24
yuki24 / incorrect_words.yml
Created Jun 3, 2015
calculates the accuracy of did_you_mean gem.
View incorrect_words.yml
# This data is based on Birkbeck Spelling Error Corpus: http://ota.ox.ac.uk/headers/0643.xml
# More specifically, this is a yaml version of the data in FAWTHROP1DAT.643 and FAWTHROP1DAT.643.
---
abattoir: abbatoir
abhorrence: abhorence
absence: absense
absorbent: absorbant
absorption: absorbtion
accede: acceed
accelerate: acellerate
@yuki24
yuki24 / simple_english.rb
Created Jun 3, 2015
A generator that creates a list of all available titles in Simple English Wiktionary
View simple_english.rb
require 'rest-client'
base_url = "http://simple.wiktionary.org/w/api.php?action=query&aplimit=23294&list=allpages&format=json"
filename = "simple_english_titles.yml"
count = nil
apfrom = nil
num = 0
titles = []
begin
@yuki24
yuki24 / memory_usage.md
Last active Aug 29, 2015
memory optimization of DidYouMean::WordCollection - round 2
View memory_usage.md

Total allocated 35900

Total retained 2

allocated memory by gem

3838000  did_you_mean/lib
  16800  ruby-2.2.2/lib

allocated memory by file

@yuki24
yuki24 / memory_usage.md
Last active Aug 29, 2015
WordCollectioin ompimization
View memory_usage.md

Total allocated 69102

Total retained 2

allocated memory by gem

6743112  did_you_mean/lib
  17600  ruby-2.2.2/lib
   8000  other

allocated memory by file

@yuki24
yuki24 / jobs-1.txt
Created Apr 26, 2015
rails new with a different number of bundler jobs
View jobs-1.txt
$ bundle config --global jobs 1
You are replacing the current global value of jobs, which is currently "4"
$ gem uni coffee-script-source execjs jbuilder columnize spring debug_inspector tilt sdoc jquery-rails sass coffee-script uglifier sass-rails coffee-rails turbolinks sqlite3 byebug binding_of_caller web-console -aIx
$ time rails new bundler-jobs-1
create
...
create vendor/assets/stylesheets/.keep
run bundle install
@yuki24
yuki24 / memory_profile.md
Last active Aug 29, 2015
memory allocation of did_you_mean gem
View memory_profile.md

Total allocated 4010

Total retained 13

allocated memory by gem

518156  did_you_mean/lib
  3624  other

allocated memory by file

@yuki24
yuki24 / after.md
Created Apr 12, 2015
`caller.first(8)` vs `caller(1, 8)`
View after.md

Total allocated 5210 Total retained 12

allocated memory by gem

783156  did_you_mean/lib
  3624  other

allocated memory by file

@yuki24
yuki24 / after.md
Last active Aug 29, 2015
Improving Jaro-Winkler
View after.md

Total allocated 240

Total retained 0

allocated memory by gem

 48000  did_you_mean/lib

allocated memory by file

48000 /GitHub/did_you_mean/lib/did_you_mean/jaro_winkler.rb