This file contains hidden or 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
tetangga = { | |
"1": {"R":"2","D":"3"}, | |
"2": {"L":"1","D":"4"}, | |
"3": {"R":"4","U":"1"}, | |
"4": {"L":"3","U":"2"} | |
} | |
def getND(kode,arah): | |
if arah in tetangga[kode[-1]]: | |
return kode[:-1]+tetangga[kode[-1]][arah] |
This file contains hidden or 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 datetime | |
WEEK = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'] | |
def dow(dd,mm,yyyy): | |
return (datetime.date(yyyy, mm, dd).weekday()+1) % 7 | |
#from python datetimemodule.c | |
def dow_c(dd, mm, yyyy): | |
y = yyyy - 1 |
This file contains hidden or 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
# | |
# Panduan Penggunaan pebahasa untuk POS Tagger | |
# | |
from hmmtagger import MainTagger | |
from tokenization import * | |
mt = None | |
def init_tag(): | |
global mt |
This file contains hidden or 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 os, sys | |
from lxml import etree | |
from rdflib import ConjunctiveGraph, Namespace, exceptions | |
from rdflib import URIRef, RDFS, RDF, OWL, BNode, Literal | |
def get_tag_no_ns(tname): | |
if "}" in tname: | |
return tname[tname.index("}")+1:] | |
else: |
This file contains hidden or 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
""" | |
Fast non-maximum suppression numpy port | |
from: | |
http://quantombone.blogspot.com/2011/08/blazing-fast-nmsm-from-exemplar-svm.html | |
""" | |
import numpy as np |
This file contains hidden or 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
""" | |
author: Peb Ruswono Aryan | |
date: 20.02.2014 | |
Simple Entity Resolution | |
read a text file (news) and resolve entities mentioned in the text | |
uses: | |
- external Part-of-Speech Tagger API (REST) | |
- Entity knowledge base over SPARQL with Regex filter |
This file contains hidden or 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
""" | |
file: html2wikitext.py | |
author: Peb Ruswono Aryan (28.02.2014) | |
desc: | |
script to convert html extracted by [http://github.com/petrabarus/perundangan](perundangan) | |
into wikitext used in http://hukum.pebbie.org | |
""" | |
import re |
This file contains hidden or 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
#!python | |
""" | |
game2048.py | |
bot to play 2048 game by http://gabrielecirulli.com/ | |
as submission for https://www.hackerrank.com/contests/2048-game/challenges/2048 | |
best score 157.2 | |
""" | |
import copy | |
import random | |
import math |
This file contains hidden or 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
""" | |
call : dump_ckan.py <ckan_website> | |
ckan_website : e.g. http://data.ukp.go.id | |
author : Peb Ruswono Aryan | |
""" | |
from __future__ import print_function | |
import json | |
import os |
This file contains hidden or 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 sys, rdflib; print rdflib.Graph().parse(sys.argv[1], format=sys.argv[2] if len(sys.argv)>2 else "json-ld").serialize(format=sys.argv[3] if len(sys.argv)>3 else "n3") if len(sys.argv)>1 else "%s <input-file> [<input-format> <output-format>]" % sys.argv[0] |
OlderNewer