Cache calculated frequency data
This doesn't help that much because it's not streamed data.
This commit is contained in:
parent
1fb756d647
commit
9dc8e4bb5e
20
toplevel.scm
20
toplevel.scm
|
@ -1,11 +1,23 @@
|
|||
(load "markov.chicken.so")
|
||||
(import markov
|
||||
(chicken format)
|
||||
srfi-18)
|
||||
srfi-18
|
||||
srfi-69
|
||||
(chicken file))
|
||||
|
||||
(display "Generating table (this may take a while)\n" (current-error-port))
|
||||
(define table (make-table-from-file "kjv.txt"))
|
||||
(display "Done generating.\n")
|
||||
(define table
|
||||
(if (file-exists? "kjv-data.scm")
|
||||
(with-input-from-file "kjv-data.scm"
|
||||
(lambda ()
|
||||
(display "Reading previously generated data.\n" (current-error-port))
|
||||
(alist->hash-table (read))))
|
||||
(with-output-to-file "kjv-data.scm"
|
||||
(lambda ()
|
||||
(display "Generating table (this may take a while)\n" (current-error-port))
|
||||
(let ((table (make-table-from-file "kjv.txt")))
|
||||
(display "done generating.\n" (current-error-port))
|
||||
(write (hash-table->alist table))
|
||||
table)))))
|
||||
|
||||
(define (generate-until-word* current collected limits)
|
||||
(if (member current limits)
|
||||
|
|
Loading…
Reference in New Issue