Skip to content

Instantly share code, notes, and snippets.

View philip30's full-sized avatar

Philip Arthur philip30

  • Oracle
  • Sydney, Australia
  • 07:31 (UTC +11:00)
View GitHub Profile
@philip30
philip30 / crawl.py
Created July 26, 2016 22:33
Crawler to crawl comparable corpora at specific site
#!/usr/bin/env python3
# First install selenium:
# pip3 install selenium
# If you don't have pip, consult here:
# https://pip.pypa.io/en/stable/installing/
# Install Google Chrome.
# Install ChromeWebdriver (and put it on your PATH environment variable):
# https://sites.google.com/a/chromium.org/chromedriver/downloads
# To use:
# Run "python3 crawl.py"
@philip30
philip30 / sudoku_solver.py
Last active July 14, 2016 14:26
Sudoku solver using complete search.
#!/usr/bin/env python3
# By Philip Arthur
# This program is intended to solve sudoku problem with a complete search.
# It simulates human's way to solve sudoku problem with following steps:
# 1. Forward Inference: Try to look at every column, row, and box; if there is only 1 possible cell for a particular number, set it.
# 2. Invalidate board: For every number that is set, we need to remove the possibility of other cells being that number in the same row, column and box.
# 3. Assign value: if there is a cell contains only 1 possible number, set it.
#
# If solution is not found, then trial and error approach is done by greedy best first search with assigning some value to the cells with less candidates.
#
@philip30
philip30 / breduct.py
Created April 16, 2014 03:25
Script for Beta Reduction (lambda = '\')
#!/usr/bin/python
import sys
import argparse
def main():
for line in sys.stdin:
line = line.strip()
output = breduct(line)
print output