AGQR の放送を保存するスクリプト.
- 31日まである月に翌日の指定が失敗する
というバグが存在する.
| # -*- coding: utf-8 -*- | |
| require 'natto' | |
| require 'msgpack' | |
| require 'mongo' | |
| texts = ['shirobako★が3巻が見たい', '大久保瑠美さんに会いたい'] | |
| trans_freq = Hash.new{|h, k| h[k] = Hash.new{0.0}} | |
| texts.each do |txt| |
AGQR の放送を保存するスクリプト.
というバグが存在する.
| # -*- coding: utf-8 -*- | |
| require 'open-uri' | |
| require 'nokogiri' | |
| require 'logger' | |
| require 'time' | |
| require 'set' | |
| require 'pp' | |
| UA = '' |
| 0 a 0.545564 | |
| 0 b 0.235328 | |
| 0 c 0.0589112 | |
| 0 d 0.160196 | |
| 1 a 0.282141 | |
| 1 b 0.400634 | |
| 1 c 0.227655 | |
| 1 d 0.0895693 | |
| 2 a 0.0782046 | |
| 2 b 0.155836 |
| a x:0.5488135039273248 y:0.7151893663724195 | |
| b x:-0.6027633760716439 y:0.5448831829968969 | |
| c x:-0.4236547993389047 y:-0.6458941130666561 | |
| d x:0.4375872112626925 y:-0.8917730007820798 | |
| a x:0.9636627605010293 y:0.3834415188257777 | |
| b x:-0.7917250380826646 y:0.5288949197529045 | |
| c x:-0.5680445610939323 y:-0.925596638292661 | |
| d x:0.07103605819788694 y:-0.08712929970154071 | |
| a x:0.02021839744032572 y:0.832619845547938 | |
| b x:-0.7781567509498505 y:0.8700121482468192 |
| #include <iostream> | |
| #include <fstream> | |
| #include <sstream> | |
| #include <unordered_map> | |
| #include <vector> | |
| #include <string> | |
| #include <algorithm> | |
| #include <boost/random.hpp> | |
| #include <iomanip> |
| #include <iostream> | |
| #include <fstream> | |
| #include <sstream> | |
| #include <unordered_map> | |
| #include <vector> | |
| #include <string> | |
| #include <algorithm> | |
| typedef std::pair<int, int> key; |
| # GMM (generalized Mixture Model) of EM | |
| # usage | |
| # gmm = GMM.new([1, 2, 3, 5, 2, 1, 10, 20, 30, 20], {k: 2}) | |
| LIM = 10 ** -5 | |
| PROB_LIM = 10 ** -100 | |
| def dist(x, mu, sigma) | |
| prob = 1.0 / (2 * Math::PI * sigma) ** 0.5 * Math::exp(-(x - mu) ** 2 / (2 * sigma)) | |
| # avoid p(x|mu, sigma) = 0.0 |
| # Xiaohui Yan, A biterm topic model for short texts(WWW 2013) | |
| require 'set' | |
| class Biterm | |
| def initialize(alpha, beta, k) | |
| @alpha = alpha | |
| @beta = beta | |
| @k = k | |
| @doc_w = { } |
| # usage: ruby ikoma.rb | pbcopy | |
| require 'nokogiri' | |
| require 'open-uri' | |
| doc = Nokogiri::HTML(open("http://d.hatena.ne.jp/mamoruk/archive?word=&of=#{rand(1550)}", :proxy => nil).read) | |
| entries = (doc/'li.archive.archive-section'/'a'); elem = entries[rand(entries.size)] | |
| puts "#{elem.inner_text} #{elem.attribute('href').value}" |