Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
research!!!

Wannaphong Phatthiyaphaibun wannaphong

🔥
research!!!
View GitHub Profile
@wannaphong
wannaphong / process_wikipedia.py
Last active Jul 17, 2019 — forked from snakers4/process_wikipedia.py
Post process wikipedia files produced by wikiextractor
View process_wikipedia.py
import os
import re
import sys
import glob
import nltk
import gensim
import numpy as np
import pandas as pd
from tqdm import tqdm
from uuid import uuid4
@wannaphong
wannaphong / how-to-gource.sh
Last active Jun 25, 2019 — forked from miguelsaddress/how-to-gource.sh
Install Gource in Ubuntu (gource.io)
View how-to-gource.sh
#Install Gource in Ubuntu
========================
#Go to the folder.... and
#see http://tylerfrankenstein.com/code/install-gource-ubuntu-1010-visualize-git-repo
# https://github.com/acaudwell/Gource/releases/download/gource-0.49/gource-0.49.tar.gz
sudo apt-get update
sudo apt-get install libglew-dev
sudo apt-get install libsdl2-dev
sudo apt install libsdl2-image-dev
@wannaphong
wannaphong / ngrams.py
Last active Sep 8, 2017 — forked from benhoyt/ngrams.py
Print most frequent N-grams in given file
View ngrams.py
# -*- coding: utf-8 -*-
"""Print most frequent N-grams in given file.
Usage: python ngrams.py filename
Problem description: Build a tool which receives a corpus of text,
analyses it and reports the top 10 most frequent bigrams, trigrams,
four-grams (i.e. most frequently occurring two, three and four word
consecutive combinations).
@wannaphong
wannaphong / LK82.py
Last active Jun 29, 2017 — forked from korakot/LK82.py
Thai Soundex LK82, Udom83
View LK82.py
# ตาม guru.sanook.com/1520
import re
t1 = str.maketrans("กขฃคฅฆงจฉชฌซศษสญยฎดฏตณนฐฑฒถทธบปผพภฝฟมรลฬฤฦวหฮอ",
"กกกกกกงจชชชซซซซยยดดตตนนททททททบปพพพฟฟมรรรรรวหหอ")
t2 = str.maketrans(
"กขฃคฅฆงจฉชซฌฎฏฐฑฒดตถทธศษสญณนรลฬฤฦบปพฟภผฝมำยวไใหฮาๅึืเแโุูอ",
"1111112333333333333333333444444445555555667777889AAABCDEEF")
def LK82(s):
res = []
@wannaphong
wannaphong / Tensorflow-GPU-ubuntu16.04.md
Last active Jun 13, 2017 — forked from unsalted/Tensorflow-GPU-ubuntu16.04.md
Ubuntu 16.04 - Tensorflow (GPU) setup
View Tensorflow-GPU-ubuntu16.04.md
@wannaphong
wannaphong / builder.py
Created Mar 8, 2017 — forked from pazdera/builder.py
Example of `builder' design pattern in Python
View builder.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Example of `builder' design pattern
# Copyright (C) 2011 Radek Pazdera
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@wannaphong
wannaphong / jdutil.py
Created Feb 11, 2017 — forked from jiffyclub/jdutil.py
Functions for converting dates to/from JD and MJD
View jdutil.py
"""
Functions for converting dates to/from JD and MJD. Assumes dates are historical
dates, including the transition from the Julian calendar to the Gregorian
calendar in 1582. No support for proleptic Gregorian/Julian calendars.
:Author: Matt Davis
:Website: http://github.com/jiffyclub
"""
@wannaphong
wannaphong / q.py
Created Jan 22, 2017 — forked from fheisler/q.py
Q-learning Tic-tac-toe
View q.py
import random
class TicTacToe:
def __init__(self, playerX, playerO):
self.board = [' ']*9
self.playerX, self.playerO = playerX, playerO
self.playerX_turn = random.choice([True, False])
def play_game(self):
@wannaphong
wannaphong / map.cs
Created Jan 22, 2017 — forked from huangcd/map.cs
a map function like python in C#
View map.cs
public static IEnumerable<TResult> Map<in TSource, TResult>(IEnumerable<TSource> sources, Func<TSource, TResult> mapper)
{
foreach (var source in sources)
{
yield return mapper(source);
}
}
@wannaphong
wannaphong / xor.py
Created Jan 22, 2017 — forked from stewartpark/xor.py
Simple XOR learning with keras
View xor.py
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.optimizers import SGD
import numpy as np
X = np.array([[0,0],[0,1],[1,0],[1,1]])
y = np.array([[0],[1],[1],[0]])
model = Sequential()
model.add(Dense(8, input_dim=2))