Skip to content

Instantly share code, notes, and snippets.

@sasamijp
sasamijp / wailangwiki.rb
Created August 23, 2015 12:39
html内にある日本語の固有名詞をわいに置換する
# -*- encoding:utf-8 -*-
require 'natto'
require 'open-uri'
@natto = Natto::MeCab.new
def conv(jp_text)
words = []
jp_text.split("\n").map do |text|
@sasamijp
sasamijp / wailang.rb
Created August 16, 2015 13:04
日本語をわいらの言葉に変換するやで
# -*- encoding:utf-8 -*-
require 'natto'
@natto = Natto::MeCab.new
def conv(jp_text)
words = []
@natto.parse(jp_text) do |n|
break if n.is_eos?
@sasamijp
sasamijp / show_status.rb
Created July 31, 2015 06:05
show tweet url by status_id
# -*- encoding:utf-8 -*-
require 'twitter'
class Const
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_TOKEN = ''
ACCESS_TOKEN_SECRET = ''
end
# -*- encoding:utf-8 -*-
require 'sequel'
require 'natto'
class Responder
def initialize
@db = Sequel.connect("sqlite://./pa.db")
@natto = Natto::MeCab.new
end
@sasamijp
sasamijp / sov.sql
Created July 3, 2015 14:17
記憶用
create table sov(
s text,
o text,
v text
);
@sasamijp
sasamijp / parser.rb
Last active August 29, 2015 14:24
パーサ
class Parser
def parse(text)
text.gsub(' ', ' ').split
end
end
@sasamijp
sasamijp / name.csv
Last active August 19, 2018 14:28
update_nameによって蓄積された名前ログ
sasamijp 2014-03-24 23:08:33 +0900 448099043776794625
おしり sasamijp 2014-03-25 08:58:06 +0900 448247409835913216
おしりターボ firstspring1845 2014-03-25 08:58:31 +0900 448247511027695616
極左 NTTrf 2014-03-25 09:35:42 +0900 448256867165159424
アナル sasamijp 2014-03-25 10:04:17 +0900 448264063898746881
菊地真はホモ 1kaguya 2014-03-25 10:04:44 +0900 448264173814702080
ちんちん sasamijp 2014-03-25 10:11:35 +0900 448265900936798209
sasamijp 2014-03-25 10:40:12 +0900 448273101990555649
アナル sasamijp 2014-03-25 16:28:21 +0900 448360718526447616
ちんちん sasamijp 2014-03-25 17:07:55 +0900 448370672822013952
@sasamijp
sasamijp / ss_analyzer.rb
Created October 25, 2014 08:18
SSparserでパースされたSSがコーパスとして適しているか判定する
# -*- encoding: utf-8 -*-
class SSAnalyzer
def corpus?(ss)
sla = sentence_length_average(ss)
ctc = consecutive_talking_count(ss)
return false if ctc.nil?
ctc = ctc/ss.length.to_f
(ctc >= 0.8) or (ctc >= 0.4 and sla <= 20)
@sasamijp
sasamijp / chimpo.rb
Created September 29, 2014 08:26
おちんぽ無限回廊
# encoding: utf-8
array = ["ち","ん","ぽ"]
c = 1
narray = []
1000.times do
narray.push array.sample
end
@sasamijp
sasamijp / ssparser.rb
Created September 28, 2014 11:40
SSから会話コーパスへの変換をするクラス
# -*- encoding: utf-8 -*-
class SSparser
def parse(body)
(body.count('『') > body.count('「')) ?
body.gsub('「', '「').gsub('『', '「').gsub('』', '」').gsub('」', '」') :
body.gsub('「', '「').gsub('」', '」')
body = body.split("\n").delete_if{|v|v.nil?}
ss = []