Skip to content

Instantly share code, notes, and snippets.

@dhruvpathak
dhruvpathak / similarity_calculation_performance.py
Created July 22, 2019 07:33
String Similarity Performance Python Vs C Bindings
import timeit
setup = '''
import difflib
import jellyfish
import Levenshtein
def difflib_result(first_str,second_str):
return difflib.SequenceMatcher(None, first_str, second_str).ratio()
@dhruvpathak
dhruvpathak / spacy_lemma.py
Created July 22, 2018 12:08
Lemmatization and POS tag correlation in spaCy
# tested on : python 3.7.0, spacy 2.0.12
import urllib
import spacy
from collections import defaultdict
from pprint import pprint
nlp = spacy.load('en')
#fetch a long essay text
text_url = "https://pastebin.com/raw/M7RwNi5q"
@dhruvpathak
dhruvpathak / bash_thanos.sh
Created May 5, 2018 10:20
Thanos bash script : Kill half of the universe randomly
kill -9 `ps aux | awk '{print $2}' | shuf | awk '!(NR%2)'`