cardmagic / classifier

A general classifier module to allow Bayesian and other types of classifications.

This URL has Read+Write access

cmcbride (author)
Sun Jan 20 04:00:06 -0800 2008
commit  ea24a2f1ea01abd882e6e354201c28a2e796133f
tree    a815f0fc7ddb5e1d7762562ac6e5cee334f019d3
parent  eb7965c2319282d00753e8fc526c09e0624db7e7
classifier / bin / summarize.rb
100755 17 lines (12 sloc) 0.278 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env ruby
 
begin
        require 'rubygems'
        require 'classifier'
rescue
        require 'classifier'
end
 
require 'open-uri'
 
num = ARGV[1].to_i
num = num < 1 ? 10 : num
 
text = open(ARGV.first).read
puts text.gsub(/<[^>]+>/,"").gsub(/[\s]+/," ").summary(num)