Skip to content

Instantly share code, notes, and snippets.

@jaydonnell
jaydonnell / emacs setup script
Created April 6, 2010 19:06
emacs setup script
#!/bin/bash
# run this from your home directory
mkdir -p projects
cd projects
git clone git://github.com/technomancy/emacs-starter-kit.git
cd ..
ln -s projects/emacs-starter-kit .emacs.d
class Jay
def talk
puts 'hi'
end
end
def make_say(msg, &b)
Jay.send(:alias_method, :orig_talk, :talk)
Jay.send(:define_method, :talk) { puts msg }
class Jay
def a; puts 'a' end
end
class Jay
define_method(:b) { puts 'b' }
end
Jay.class.send(:define_method, :c) { puts 'c' }
gem "sinatra", "0.9.4"
gem "scrappy", "0.1", :git => "git://internal.com/scrappy/mainline.git"
require 'rubygems'
require 'sinatra'
configure do
set :data, "none"
end
before do
content_type 'text/plain', :charset => 'utf-8'
request.env['PATH_INFO'].gsub!(/\/$/,'')
def debug_line(*list)
ret = "Debug: "
0.step(list.length - 2, 2) do |x|
label, value = list[x,x+2]
ret += "#{label} = '#{value}', "
end
puts ret
end
debug_line("a", 10, "b", 20)
irb(main):011:0> a = "abcd"
=> "abcd"
irb(main):012:0> a[1,1] = a[2,1]
=> "c"
irb(main):013:0> a
=> "accd"
# myapp.rb
require 'rubygems'
require 'sinatra'
get '/' do
'Hello world!'
end
Yes sorry.
Basically what we are trying is to constraint the effect of the raw frequency (saturate the frequency).
In Lucene this is carried out with the root square of the frequency, another classical approach
is to use the log. With both approaches we avoid giving a linear 'importance' to the frequency.
BM25 is a bit tricky, it parametrises the 'saturation' of the frequency with a parameter k1, with the
equation weight(t)/(weight(t)+k1). Usually k1 is fixed to 2, but it can be fixed by collection.
#!/bin/bash
# backup your delicious bookmarks
curl -k --user `cat password.txt` -o backup.xml -O 'https://api.del.icio.us/v1/posts/all'