Skip to content

Instantly share code, notes, and snippets.

View osori's full-sized avatar

Ilkyu Ju osori

View GitHub Profile
public class SortingTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] alist = {54,26,93,17,77,31,44,55,20};
printArray(alist);
//selectionSort(alist);
//insertionSort(alist);
@osori
osori / ngram_analyzer.py
Last active October 31, 2017 00:54
This python script can analyze n-grams from word or phoneme level. | 음절/어절 단에서 n-gram을 분석해주는 파이썬 스크립트입니다.
#!/usr/bin/env python3
# -*- coding:utf-8 -*-]
sample_text = "신은 다시 일어서는 법을 가르치기 위해 넘어뜨린다고 나는 믿는다."
def word_ngram(sentence, num_gram):
ngrams = []
text = list(sentence) # split the sentence into an array of characters
ngrams = [text[x:x+num_gram] for x in range(0, len(text))]
@osori
osori / phyundai.py
Last active November 24, 2017 05:35
pangyo-hyundai
# Jupyter Notebook에서 실행하세요
from IPython.display import Image, display
from bs4 import BeautifulSoup
import requests
print("어서오세요 품격과 전통의 판교 현백입니다.\n 어떤 물건을 찾으세요?")
query = input() # 유저 인풋 받아오기
@osori
osori / trie_node.py
Created December 2, 2017 17:54
Trie Node implementation in Python
class Node(object):
"""
A node that consists of a trie.
"""
def __init__(self, key, data=None):
self.key = key
self.data = data
self.children = {}
@osori
osori / pickling.py
Last active December 3, 2017 18:28
Pickling in Python (Object serialization)
import pickle
with open("myobject.lq", "wb") as file:
pickle.dump(object(), file)
# object() 자리에 파일로 내보내고 싶은 객체를 넣으면 된다.
@osori
osori / unpickling.py
Last active December 3, 2017 18:38
Unpickling in Python (Object de-serialization)
import pickle
with open("myobject.lq", "rb") as file:
my_obj = pickle.load(file)
# 이후 my_obj 는 일반적인 객체랑 똑같이 사용할 수 있다.
@osori
osori / py_trie.py
Last active February 7, 2021 12:38
파이썬에서 Trie 구현
class Trie(object):
def __init__(self):
self.head = Node(None)
"""
트라이에 문자열을 삽입합니다.
"""
def insert(self, string):
curr_node = self.head
@osori
osori / trie.py
Last active December 10, 2023 12:13
Trie implementation in Python
class Node(object):
"""
A single node of a trie.
Children of nodes are defined in a dictionary
where each (key, value) pair is in the form of
(Node.key, Node() object).
"""
def __init__(self, key, data=None):
self.key = key