This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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?" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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', |