public
Description: A language detection library for Ruby that uses bloom filters for speed.
Homepage:
Clone URL: git://github.com/peterc/whatlanguage.git
whatlanguage / build_filter.rb
100644 9 lines (8 sloc) 0.361 kb
1
2
3
4
5
6
7
8
9
# Use this to build new filters (for other languages, ideally) from /usr/share/dict/words style dictionaries..
#
# Call like so..
# ruby build_filter.rb /usr/share/dict/words lang/english.lang
# (replace params as necessary)
 
require 'lib/whatlanguage'
filter = WhatLanguage.filter_from_dictionary(ARGV[0])
File.open(ARGV[1], 'wb') { |f| f.write filter.dump }