Ruby Jekyll LSI Classifier Fixes

It was a bit of a pain to get the LSI classifier feature of jekyll to work with rb-gsl. The gem doesn’t work and there’s a bug in the classifier gem. Here’s what I did to get it working:

  1. Check out the latest rb-gsl from svn: svn checkout svn://rubyforge.org/var/svn/rb-gsl/trunk
  2. Build and install that (simple instructions in the README)
  3. Install the classifier gem
  4. Change the classifier-1.3.1/lib/classifier/lsi.rb file from this

Around line 290:

def build_reduced_matrix( matrix, cutoff=0.75 )
  # ...
  # Reconstruct the term document matrix, only with reduced rank
  u * Matrix.diag( s ) * v.trans
end

To this:

def build_reduced_matrix( matrix, cutoff=0.75 )
  # ...
  # Reconstruct the term document matrix, only with reduced rank
  if $GSL
    u * GSL::Matrix.diag( s ) * v.trans
  else
    u * Matrix.diag( s ) * v.trans
  end
end

Without rb-gsl, the jekyll lsi classifier is way, way too slow to use after you get more than a handful of posts.


Related Posts

  1. iPhone/iPad UISearchBar and UISearchDisplayController Asynchronous Example
  2. Rails Fragment Caching With Multiple Accounts
  3. Feedtools Database Cache
  4. Getting Rails 2 Release Candidate To Work
  5. Authlogic, Passenger, and cookie_store Sessions Don't Mix
You should follow me on Twitter: @patrickxb