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'))
@dkavraal
dkavraal / türkçe.py
Last active January 3, 2020 07:46
in Turkish texts detecting which charset among cp1254 (windows 1254) and UTF-8 is used
"""
Letter Codes
------------------------
LETTER Windows-1254 ISO-8859-9 latin5 UTF-8
ğ b'\xf0' b'\xf0' b'\xf0' b'\xc4\x9f'
ı b'\xfd' b'\xfd' b'\xfd' b'\xc4\xb1'
ş b'\xfe' b'\xfe' b'\xfe' b'\xc5\x9f'
ü b'\xfc' b'\xfc' b'\xfc' b'\xc3\xbc'
ö b'\xf6' b'\xf6' b'\xf6' b'\xc3\xb6'
;; 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.
@dkavraal
dkavraal / Setting_Up_Email_Receiving_in_AWS_Lambda_and_Forwarding.md
Last active November 23, 2020 22:27
AWS Lambda Receive Email Forward Function

Set up an IAM Role called (say) SNSEmailForwarder:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
 "Action": [