Skip to content

Instantly share code, notes, and snippets.

View yuki24's full-sized avatar
🔢
NaN :trollface:

Yuki Nishijima yuki24

🔢
NaN :trollface:
View GitHub Profile
@yuki24
yuki24 / incorrect_corrections.yml
Last active August 29, 2015 14:22
A list of Incorrect corrections generated by did_you_mean's spell checker
#- correct_word: incorrect_word(user input)
# result:
# - list_of_candidates
---
- absence: absense
result:
- absences
- absents
- absence
- absentee
@yuki24
yuki24 / calculate_accuracy.rb
Last active August 29, 2015 14:22
How accurate is the did_you_mean gem?
# 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 June 3, 2015 23:44
calculates the accuracy of did_you_mean gem.
# 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 June 3, 2015 22:38
A generator that creates a list of all available titles in Simple English Wiktionary
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 August 29, 2015 14:20
memory optimization of DidYouMean::WordCollection - round 2

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 August 29, 2015 14:20
WordCollectioin ompimization

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 April 26, 2015 18:56
rails new with a different number of bundler jobs
$ 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 August 29, 2015 14:19
memory allocation of did_you_mean gem

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 April 12, 2015 17:47
`caller.first(8)` vs `caller(1, 8)`

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 August 29, 2015 14:19
Improving Jaro-Winkler

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