BOOM Analytics: Exploring Data-Centric, Declarative Programming for the Cloud
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns ignacio.tfidf (:require [clojure.contrib.string :as string])) ;; Simple tfidf in clojure, for fun. | |
(def stopwords (set (string/split #"\n" (slurp "./stopwords.txt")))) | |
(defn tokenize [raw-text] ;; Lowercases and splits on non-letters, non-numbers. | |
(remove stopwords (string/split #"[^a-z0-9äöüáéíóúãâêîôûàèìòùçñ]+" (string/lower-case raw-text)))) | |
(defn idf2 [n-docs match] (Math/pow (Math/log (/ n-docs (count (keys match)))) 2)) | |
(defn index-one [fname] ;; Index for one file. Given an fname, returns a map of token -> map of (fname, count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapely | |
import fiona | |
from fiona import collection | |
import csv | |
star_csv = csv.reader(open('hygxyz.csv', 'rb')) | |
header = star_csv.next() | |
max_x = 10000000 |
Follow the installation and activation instructions for the U.S. Custom keyboard layout.
If you’re using macOS Sierra (10.12), install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Examples for some pyqgis common functions. | |
Some may be outdated as things can be done easier in qgis3 now but they should just be an example | |
for some functions that were use to make life easier during the development of QGIS plugins: | |
examples from https://github.com/boundlessgeo/lib-qgis-commons/blob/master/qgiscommons2/layers.py | |
def load_layer(filename, name = None): | |
''' | |
Tries to load a layer from the given file | |
:param filename: the path to the file to load. |