Skip to content

Instantly share code, notes, and snippets.

@vishnuvyas
vishnuvyas / iterm2-solarized.md
Created Dec 5, 2020 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel10k

Powerlevel10k

@vishnuvyas
vishnuvyas / ContextExtractor.java
Created Apr 3, 2020
Way to extract the context around a particular hit
View ContextExtractor.java
import java.util.*;
import java.util.stream.*;
class ContextExtractor {
public static class TagResult {
public String token;
public int start;
public int end;
View metrics api definition
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
View Terms for face2face js
TAGGER.put("psych:","psych:")
TAGGER.put("rectal:","rectal:")
TAGGER.put("overview normal.","overview normal.")
TAGGER.put("abdom:","abdom:")
TAGGER.put("speech normal","speech normal")
TAGGER.put("follow-up","follow-up")
TAGGER.put("chronic","chronic")
TAGGER.put("extensive","extensive")
TAGGER.put("resulting","resulting")
TAGGER.put("denied","denied")
@vishnuvyas
vishnuvyas / bintree-dict.scm
Created Sep 18, 2011
A simple key-value style dictionary implementation in scheme (uses binary trees)
View bintree-dict.scm
(define (make-table-cell key val)
;; make a symbol table - atleast one table is required.
(cons (cons key value) (cons #f #f)))
;; some functions to access individual table cells
(define (get-key table-cell) (caar table))
(define (get-value table-cell) (cdr (car table)))
(define (get-left table-cell) (car (cdr table)))
(define (get-right table-cell) (cdr (cdr table)))
@vishnuvyas
vishnuvyas / levenshtein.clj
Created May 6, 2011
A purely functional implementation of levenshtein distance in clojure
View levenshtein.clj
(ns levenshtein
^{:doc "A purely functional implementation of the levenshtien distance in clojure"})
(defn- compute-next-row
"computes the next row using the prev-row current-element and the other seq"
[prev-row current-element other-seq pred]
(reduce
(fn [row [diagonal above other-element]]
(let [update-val
(if (pred other-element current-element)
@vishnuvyas
vishnuvyas / gramgen.clj
Created Apr 5, 2011
A port of a simple grammar generator in PAIP from common lisp to clojure
View gramgen.clj
(ns gramgen
{:doc
"GramGen generates sentences from a CFG. Comes with an inbuilt cfg - This is based on the program on
chapter 2, and it can be written much simpler, but this program is written the way it is because I wanted
to try out some new features of clojure.
to generate a random tree use the function generate-tree, which generates a random parse tree from
the grammar we have provided. If you want to use a more advanced grammar, then use the create grammar
function to create a complex grammars. Grammars are represented as seqences where the first of the
seqence is the LHS for the grammar and the rest are RHS choices for the grammar. If the rhs itself