Skip to content

Instantly share code, notes, and snippets.

import sys
import numpy
from nltk.cluster import KMeansClusterer, GAAClusterer, euclidean_distance
import nltk.corpus
from nltk import decorators
import nltk.stem
stemmer_func = nltk.stem.snowball.EnglishStemmer().stem
stopwords = set(nltk.corpus.stopwords.words('english'))
;; The first three lines of this file were inserted by DrScheme.
;; They record information about the language level.
#reader(lib "plai-pretty-big-reader.ss" "plai")((modname proje) (read-case-sensitive #t) (teachpacks ()))
;; Comp 314 - Project 9
;; Anıl Özselgin (10276040) - Ahmet Sevimli (10276043)
(define p3->p1
(lambda (f)
(lambda (p1)
(lambda (p2)
;; The first three lines of this file were inserted by DrScheme.
;; They record information about the language level.
#reader(lib "plai-pretty-big-reader.ss" "plai")((modname proje) (read-case-sensitive #t) (teachpacks ()))
(define p2->p1
(lambda (f)
(lambda (p1)
(lambda (p2)
(f p2 p1)))))
;; The first three lines of this file were inserted by DrScheme.
;; They record information about the language level.
#reader(lib "plai-pretty-big-reader.ss" "plai")((modname pro9) (read-case-sensitive #t) (teachpacks ()))
(define (AEfoldin op nv list)
(cond
((null? list) nv)
((null? (rest list)) (AEfoldin op (op (first list) (op nv)) (rest list))) ;(op nv) => -3 vb icin
(else (AEfoldin op (op nv (first list)) (rest list)))))
(define (AEfold op nv list) (AEfoldin op nv (reverse list)))
;; The first three lines of this file were inserted by DrScheme.
;; They record information about the language level.
#reader(lib "plai-pretty-big-reader.ss" "plai")((modname collection) (read-case-sensitive #t) (teachpacks ()))
;AEfold : (lv rv -> rv) rv (list of lv) -> rv
;consumes an operation (f), a null value and a list; and operates f on the list at Scheme order
;Ex:
;(AEfold - 0 (1 2 3 4)) -> -8 ;(foldr - 0 '(1 2 3 4))->-2 , (foldl - 0 '(1 2 3 4)) -> 2
;(AEfold + 0 (3 5 7)) ->15 ;(foldr + 0 '(3 5 7)) ->15
;(AEfold / 1 (3 9 8)) -> 1/24 ; (foldr / 1 '(3 9 8)) -> 2 2/3 , (foldl / 1 '(3 9 8)) -> 2 2/3
;(AEfold / 1 (3 9 5 6)) -> 1/90 ; (foldr / 1 '(3 9 5 6)) ->5/18 , (foldl / 1 '(3 9 5 6))->3 3/5
@dkavraal
dkavraal / boot0 problem
Created May 30, 2014 09:44
osx win linux multiboot
http://www.niresh12495.com/apple/articles/how-to/how-to-fix-the-boot0-error-for-your-hackintosh-r25/
@dkavraal
dkavraal / copyPBar.sh
Last active August 29, 2015 14:03
a few bash helper
alias cp='rsync -p --progress'
# copy with progressbar
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function pips() { ⏎
for pkg in $@; do
pip install "$pkg" && {
name="$(pip show "$pkg" | grep Name: | awk '{print $2}')";
version="$(pip show "$pkg" | grep Version: | awk '{print $2}')";
echo "${name}==${version}" | tee -a requirements.txt;
}
done
}
@dkavraal
dkavraal / vscode.json
Created April 25, 2018 14:44
vscode user settings
{
"workbench.iconTheme": "material-icon-theme",
"explorer.confirmDelete": false,
"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.fontFamily": "Meslo LG M for Powerline",
"terminal.integrated.shellArgs.osx": ["-l", "-Y", "-X", "-M", "-0", "-8"],
"terminal.integrated.lineHeight": 1.2,
"terminal.integrated.env.osx": {
"LC_CTYPE": "UTF-8",
"COLORFGBG": "15;0",