Skip to content

Instantly share code, notes, and snippets.

@tsmacdonald
Last active December 27, 2015 12:48
Show Gist options
  • Save tsmacdonald/7328178 to your computer and use it in GitHub Desktop.
Save tsmacdonald/7328178 to your computer and use it in GitHub Desktop.
Wizard-Professor Setup
  • git clone https://github.com/tsmacdonald/wizard-professor.git or copy it from the turnin directory
  • Create ~/.sbclrc and paste in the following:
(let ((quicklisp-init "/homes/tim.macdonald/quicklisp/setup.lisp"))
	(when (probe-file quicklisp-init)
	(load quicklisp-init)))
  • Create .config/common-lisp/source-registry.conf.d/projects.conf and paste in the following, changing the path as necessary:
(:tree (:home "src/submissions"))
  • Open GNU Emacs
  • M-: and enter: (load (expand-file-name "~tim.macdonald/quicklisp/slime-helper.el"))
  • M-: and enter: (setq inferior-lisp-program "sbcl")
  • M-x and enter: slime
  • Wait a while for Lisp to get its act together
  • At the prompt, enter:
(ql:quickload "wizard-professor")
  • Then enter:
(in-package #:wizard-professor)
  • Congratulations, the environment is set up! First we need a model:
(defparameter *frequencies* (train-trigram-model "corpus/brown-corpus-clean"))

This'll take a minute or so. Now we can correct what we want:

(correct-file *frequencies* "enter-a-filename-here")

and it'll spit out the corrected version. If you'd like it to write to disk:

(with-open-file (out "output-file-name" :direction :output)
  (correct-file *frequencies* "input-file" out))

And if you just want to play:

(correct-line "Enter a sentence here" *frequencies*)

It's not fast (< 15 seconds per word, assuming it gets a core to itself. Possibly as few as 5 seconds.); sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment