This file contains hidden or 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 re | |
| print [g.start() for g in re.finditer("AT", "CAAATATGAGACATAGACATAGACAGATACG")] | |
| #to match any base (really, any character), use a dot: | |
| print [g.start() for g in re.finditer("G.G", "CAAATATGAGACATAGACATAGACAGAGACG")] | |
| #to match a subgroup: | |
| print [g.start() for g in re.finditer("[AT][AT]", "CAAATATGAGACATAGACATAGACAGAGACG")] |
This file contains hidden or 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
| (require '[net.cgrand.enlive-html :as html]) | |
| (defn fetch-url [url] | |
| (html/html-resource | |
| (java.net.URL. url))) | |
| (defn fetch-twss [n] | |
| (drop-last 2 | |
| (map #(second (re-find #"\"(.+?)\"" (html/text %))) | |
| (html/select |
This file contains hidden or 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
| from numpy import argmax | |
| from scipy import arange | |
| from scipy.io import wavfile | |
| from scipy.fftpack import fftfreq, rfft, fftshift | |
| import pylab | |
| sample_rate, signal = wavfile.read("goodnight.wav") | |
| N = len(signal) |
This file contains hidden or 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
| (defn levenshtein [vec1 vec2] | |
| (cond (empty? vec1) (count vec2) | |
| (empty? vec2) (count vec1) | |
| :else | |
| (let [distance (make-array Integer (count vec1) (count vec2))] | |
| (doseq [i (range (count vec1))] | |
| (aset distance i 0 i)) | |
| (doseq [j (range (count vec2))] | |
| (aset distance 0 j j)) | |
| (doseq [i (range 1 (count vec1))] |
NewerOlder