Skip to content

Instantly share code, notes, and snippets.

View odashi's full-sized avatar
🏠
Working from home

Yusuke Oda odashi

🏠
Working from home
View GitHub Profile
@odashi
odashi / crowl.py
Created March 2, 2014 17:44
Simple Web crowler
# coding: utf-8
import chardet
import datetime
import html.parser
import optparse
import os
import re
import sys
@odashi
odashi / bleu.py
Last active January 1, 2016 04:29
BiLingual Evaluation Understudy (BLEU) between corpus and BLEU+1 per sentence
# coding: utf-8
import sys
import codecs
import math
from collections import defaultdict
# calculate BLEU score between two corpus
def BLEU(ws_hyp, ws_ref, **kwargs):
# check args
@odashi
odashi / ibm1.py
Last active December 30, 2015 11:09
IBM Translation Model 1
# coding: utf-8
import codecs
import sys
from collections import defaultdict
# calculate IBM Model 1 translation probability
# params:
# fname_e: <str> name of corpus file in target language
# fname_f: <str> name of corpus file in foreign language
@odashi
odashi / iritweet.php
Last active June 25, 2018 10:26
PHPでTwitterのOAuth認証をするサンプルコード
<?php
/* PHPでTwitter OAuth認証を行うサンプル・プログラム
* Author : お出汁
* Creation : 2010/10/12
* Update : 2013/01/21
* Version : 0.3
* Twitter API Wikiのabraham's twitteroauth 0.2.0を使わせて頂いています。
*/
require_once('twitteroauth/twitteroauth.php');
@odashi
odashi / taketa.pas
Created December 15, 2012 14:24
2006年に授業で作った多倍長電卓。
program TaketaDentaku(input, output);
const KETA_MAX = 30;
type su = array[0 .. KETA_MAX - 1] of integer;
type kazu = record
plus: Boolean;
keta: integer;
abs: su;
end;