This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mail_address = '' | |
password = '' | |
from selenium import webdriver | |
UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0' | |
PHANTOMJS_ARG = {'phantomjs.page.settings.userAgent': UA} | |
driver = webdriver.PhantomJS(desired_capabilities=PHANTOMJS_ARG) | |
url = 'https://www.google.com/accounts/Login?hl=ja&continue=http://www.google.co.jp/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding:utf-8 | |
import re | |
import socket | |
import subprocess | |
import time | |
HOST = "127.0.0.1" | |
PORT = 10500 | |
JULIUS_DIR = 'C:\Program Files (x86)\julius-4.4.2-win32bin\\' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import unicodedata | |
for unicode_id in xrange(65536): | |
char = unichr(unicode_id) | |
normalized_char = unicodedata.normalize('NFKC', char) | |
if char != normalized_char: | |
if len(normalized_char) == 1: | |
print u'[%d] %s -> [%d] %s' % (unicode_id, char, ord(normalized_char), normalized_char) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Airline": "Airline Industry Services", | |
"American Restaurant": "New American Restaurant", | |
"Amusement Park Ride": "Roller Coaster", | |
"Amusement": "Arcade", | |
"Amusement": "Bingo Hall", | |
"Amusement": "Go Karting", | |
"Amusement": "Laser Tag", | |
"Antiques & Vintage": "Antique Store", | |
"Antiques & Vintage": "Auction House", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def weighted_levenshtein(a, b, insert=1, delete=1, substitute=1): | |
len_a = len(a) | |
len_b = len(b) | |
m = [ [0] * (len_b + 1) for i in xrange(len_a + 1) ] | |
for i in xrange(len_a + 1): | |
m[i][0] = i * delete | |
for j in xrange(len_b + 1): | |
m[0][j] = j * insert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.sparse import csr_matrix | |
def dict2sparse(d): | |
data = list(d.values()) | |
indices = list(d.keys()) | |
indptr = [0, len(d)] | |
return csr_matrix((data, indices, indptr), shape=(1, max(d)+1), dtype=np.uint32) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#define NUM_PATTERN 5 | |
#define MAX_LENGTH 255 | |
char user_input; | |
int idx; | |
char response[NUM_PATTERN][MAX_LENGTH]={ | |
{"さすがですね!"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir ~/smt | |
cd ~/smt | |
# Install Moses | |
export BOOST_ROOT=/usr/local/Cellar/boost/1.57.0 | |
export BOOST_BUILD_PATH=/usr/local/share/boost-build | |
ln /usr/local/Cellar/boost/1.57.0/lib/libboost_thread-mt.a /usr/local/Cellar/boost/1.57.0/lib/libboost_thread.a | |
ln /usr/local/Cellar/boost/1.57.0/lib/libboost_thread-mt.dylib /usr/local/Cellar/boost/1.57.0/lib/libboost_thread.dylib | |
ln -s /usr/local/Cellar/boost/1.57.0/lib /usr/local/Cellar/boost/1.57.0/lib64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple | |
import np | |
class Bursts: | |
def __init__(level, start, end): | |
self.level = level | |
self.start = start | |
self.end = end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Required download | |
# cudnn-8.0-linux-x64-v5.1.tgz | |
curl -L -o cuda_8.0.44_linux.run https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/cuda_8.0.44_linux-run | |
curl -L -O http://us.download.nvidia.com/XFree86/Linux-x86_64/367.27/NVIDIA-Linux-x86_64-367.27.run | |
sudo apt-get install build-essential | |
sudo apt-get install linux-image-extra-`uname -r` | |
sudo sh cuda_8.0.44_linux.run | |
echo -e "export CUDA_HOME=/usr/local/cuda\nexport PATH=\$PATH:\$CUDA_HOME/bin\nexport LD_LIBRARY_PATH=\$LD_LINKER_PATH:\$CUDA_HOME/lib64" >> ~/.bashrc |
NewerOlder