Skip to content

Instantly share code, notes, and snippets.

@Salinger
Salinger / mecab_test.py
Created January 17, 2013 10:24
MeCabの動作確認用。
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import MeCab
m = MeCab.Tagger("-Ochasen")
string = u"それサバンナでも同じ事言えんの?"
# MeCabでUnicode文字列を扱う場合は、一度エンコードする必要がある。
# この際、
# node = tagger.parseToNode(string.encode("utf-8"))
@Salinger
Salinger / libsvm_test.py
Created January 20, 2013 17:17
Test code for libsvm-python.
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from svm import *
from svmutil import *
# For learning
t_label = [1,-1,1,-1]
t_data = [
[1.0, 2.0, 3.0],
library(ggplot2) # For Plot
library(kernlab) # For SVM
auth = read.table("./CodeIQ_auth.txt",header=F,sep=" ")
names(auth) <- c("volume","weight","truth") # 0 is Fake
my_coins = read.table("./CodeIQ_mycoins.txt",header=F,sep=" ")
names(my_coins) <- c("volume","weight")
g = ggplot(auth,aes(x=volume,y=weight)) + geom_point(aes(color=truth))
m = MeCab::Tagger.new "-Ochasen -u lib/wikipedia_user.dic"
mecab_str = m.parse(string)
c = CaboCha::Parser.new "-f4 -I1"
lines = c.parseToString(mecab_str).force_encoding("UTF-8")
@Salinger
Salinger / bq_tweet.json
Last active August 29, 2015 14:20
tweet_json_bq
[
{
"name": "log_time",
"type": "INTEGER"
},
{
"name": "created_at",
"type": "STRING"
},
{
@Salinger
Salinger / bq_tweet.json
Created May 12, 2015 06:13
bq_tweet.json
[
{
"name": "log_time",
"type": "INTEGER"
},
{
"name": "created_at",
"type": "STRING"
},
{
#!/usr/bin/env python
#-*- coding:utf-8 -*-
### Library
import MySQLdb
import pandas.io.sql as psql
import pandas as pd
import numpy as np
import MeCab
from gensim import corpora
@Salinger
Salinger / member_count.csv
Created December 4, 2016 06:44
滞在人数
time count
0 42
4 42
8 42
12 42
16 41
20 41
24 41
28 41
32 41
@Salinger
Salinger / 01_100values.csv
Created April 9, 2017 07:07
01_100values.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
64
90
145
152
214
93
98
66
116
129
@Salinger
Salinger / 02_smoke.csv
Created April 9, 2017 08:01
02_smoke.csv
member is_smoking
A 1
B 0
C 0
D 1
E 0
F 0
G 0
H 0
I 0