Skip to content

Instantly share code, notes, and snippets.

View canslove's full-sized avatar

Daniel (Donghyun) Kang canslove

View GitHub Profile
@canslove
canslove / mutual_info.py
Created June 23, 2021 16:02 — forked from GaelVaroquaux/mutual_info.py
Estimating entropy and mutual information with scikit-learn: visit https://github.com/mutualinfo/mutual_info
'''
Non-parametric computation of entropy and mutual-information
Adapted by G Varoquaux for code created by R Brette, itself
from several papers (see in the code).
This code is maintained at https://github.com/mutualinfo/mutual_info
Please download the latest code there, to have improvements and
bug fixes.
@canslove
canslove / bag-of-word-vectors.py
Created December 15, 2020 04:24 — forked from edubey/bag-of-word-vectors.py
Code to generate bag of word vectors in Python
# import statments
import numpy
import re
'''
Tokenize each the sentences, example
Input : "John likes to watch movies. Mary likes movies too"
Ouput : "John","likes","to","watch","movies","Mary","likes","movies","too"
'''
def tokenize(sentences):
@canslove
canslove / Text-summarization.py
Created December 15, 2020 04:23 — forked from edubey/Text-summarization.py
Text Summarizer in Python
#!/usr/bin/env python
# coding: utf-8
from nltk.corpus import stopwords
from nltk.cluster.util import cosine_distance
import numpy as np
import networkx as nx
def read_article(file_name):
file = open(file_name, "r")