|
|
@@ -69,34 +69,18 @@ |
|
|
|
;; 2 ;; |
|
|
|
;;;;;;; |
|
|
|
|
|
|
|
;; Tabell fra 2b |
|
|
|
|
|
|
|
;; (define (make-table) |
|
|
|
;; (list '*table*)) |
|
|
|
;; |
|
|
|
;; (define (table-lookup key table) |
|
|
|
;; (let ((record (assoc key (cdr table)))) |
|
|
|
;; (and record (cdr record)))) |
|
|
|
;; |
|
|
|
;; (define (table-insert! key value table) |
|
|
|
;; (let ((record (assoc key (cdr table)))) |
|
|
|
;; (if record |
|
|
|
;; (set-cdr! record value) |
|
|
|
;; (set-cdr! table |
|
|
|
;; (cons (cons key value) (cdr table)))))) |
|
|
|
|
|
|
|
;; Node for the binary tree table. |
|
|
|
;; Arguments: |
|
|
|
;; k: Key |
|
|
|
;; v: Value |
|
|
|
;; l: Left child |
|
|
|
;; r: Right child |
|
|
|
|
|
|
|
;; Make table (implemented as a binary tree). |
|
|
|
;; Arguments: |
|
|
|
;; eq: Predicate for equality. |
|
|
|
;; lt: Predicate for less than. |
|
|
|
(define (make-table eq lt) |
|
|
|
|
|
|
|
;; Node for the binary tree table. |
|
|
|
;; Arguments: |
|
|
|
;; k: Key |
|
|
|
;; v: Value |
|
|
|
;; l: Left child |
|
|
|
;; r: Right child |
|
|
|
(define (make-node k v l r) |
|
|
|
(list k v l r)) |
|
|
|
|
|
|
@@ -329,6 +313,4 @@ |
|
|
|
(display (lm-score lm (car sentences))) |
|
|
|
(newline) |
|
|
|
(iter2 lm (cdr sentences))))) |
|
|
|
(iter2 lm (read-corpus "test.txt")) |
|
|
|
|
|
|
|
(lm-lookup-bigram lm "illegal," "unfair")) |
|
|
|
(iter2 lm (read-corpus "test.txt"))) |