Skip to content

Instantly share code, notes, and snippets.

View Incredicorp's full-sized avatar

Marco Kotrotsos Incredicorp

View GitHub Profile
require 'classifier'
require 'madeleine'
b = SnapshotMadeleine.new("bayes_data1") {
Classifier::Bayes.new 'Weather', 'Politics'
}
b.system.train_politics "I don't understand democrates and their policies"
b.system.train_politics "republicans are losers, mc cain cannot win from the democratic party"
b.system.train_weather "it's hot today isn't it? what is it, about 100 degrees?"
# Zemanta API Post Call.
require 'net/http'
require 'rubygems'
require 'xmlsimple'
gateway = 'http://api.zemanta.com/services/rest/0.0/'
text = 'Paris sera toujours Paris?'
res = Net::HTTP.post_form(URI.parse(gateway),
{
'method'=>'zemanta.suggest',