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 React, { useState, useRef } from "react"; | |
const Table = ({ columns, data }) => { | |
const [rows, setRows] = useState<{ [key: string]: any }[]>(data); | |
const [editMode, setEditMode] = useState(false); | |
const inputRef = useRef<HTMLInputElement[]>(); | |
const addRow = () => { | |
setRows([...rows, {}]); | |
}; |
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 java.util.*; | |
import java.util.stream.*; | |
class ContextExtractor { | |
public static class TagResult { | |
public String token; | |
public int start; | |
public int end; |
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ |
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
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") |
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
(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))) |
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 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) |
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 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 |