Skip to content

Instantly share code, notes, and snippets.

@ybenjo
ybenjo / make_trans_prob.rb
Created April 24, 2015 00:12
markov chain table
# -*- 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|
module.exports = (robot) ->
robot.hear /mecab (.*)/i, (msg) ->
text = msg.match[1]
MeCab = new require 'mecab-async'
mecab = new MeCab()
ret = mecab.parseSync(text)
msg.send text
// Generated by CoffeeScript 1.9.2
(function() {
module.exports = function(robot) {
return robot.hear(/mecab (.*)/i, function(msg) {
var MeCab, mecab, ret, text;
text = msg.match[1];
MeCab = new require('mecab-async');
mecab = new MeCab();
ret = mecab.parseSync(text);
return msg.send(text);
require 'json'
class Hoge
def initialize
@a=1
@b='hoge'
@c={:a => 1}
end
def to_json
#http://www.logos.t.u-tokyo.ac.jp/www/home/chik/algorithm-design/08%20Graph%20Algorithms.pdfの38枚目を参考に
class OKAJIMA
def initialize(file_path)
@maze = Array.new()
open(file_path).each do |l|
@maze.push l.chomp.split(//)
end
@cost = Hash.new(1/0.0)
@det = Hash.new()
# -*- coding: utf-8 -*-
#Generalized Co-HITSを計算するスクリプト
#A Generalized Co-HITS Algorithm and Its Application to Bipartite Graphs
#Hongbo Deng* The Chinese Univ. of Hong Kong; Michael Lyu The Chinese University of Hong Kong; IRWIN KING Chinese University of Hong Kong
#http://portal.acm.org/citation.cfm?id=1557051
#入力は
#u_1 \t v_1 \t count
# -*- coding: utf-8 -*-
#/opt/lcoal/bin/ruby
#Query Clustering using Click-Through Graph
#http://portal.acm.org/citation.cfm?id=1526853
class BiGraph
def initialize
@nodes = Hash.new{|h,k|h[k] = 0}
@out_degree = Hash.new{|h,k|h[k] = 0}
@in_degree = Hash.new{|h,k|h[k] = 0}
\documentclass[11pt,a4paper]{jsarticle}
\title{離散最適化 課題3}
\date{\today}
\author{ore}
\begin{document}
\maketitle
\begin{equation}
;;;デフォ
(set-language-environment "Japanese")
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-locale-environment "utf-8")
(setenv "LANG" "ja_JP.UTF-8")
;;;みみっちい設定
(require 'ess-site)
(setq ess-ask-for-ess-directory nil)
(setq ess-pre-run-hook
'((lambda ()
(setq default-process-coding-system '(sjis . sjis))
)))
(set-language-environment "Japanese")
(set-default-coding-systems 'sjis)
(set-terminal-coding-system 'sjis)