Skip to content

Instantly share code, notes, and snippets.

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")
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))
@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],
@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"))