[dyslexia-cvs] r4 - dyslexia/trunk
loliveira at common-lisp.net
loliveira at common-lisp.net
Sun Apr 23 19:28:40 UTC 2006
Author: loliveira
Date: Sun Apr 23 15:28:36 2006
New Revision: 4
Added:
dyslexia/trunk/COPYRIGHT
dyslexia/trunk/dyslexia.asd
dyslexia/trunk/package.lisp
Modified:
dyslexia/trunk/spell.lisp
Log:
- Add package and system definition.
- Add copyright notices.
- Remove tabs from spell.lisp.
Added: dyslexia/trunk/COPYRIGHT
==============================================================================
--- (empty file)
+++ dyslexia/trunk/COPYRIGHT Sun Apr 23 15:28:36 2006
@@ -0,0 +1,21 @@
+Copyright (C) 2006 Robert Strandh <strandh at labri.fr>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use, copy,
+modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
Added: dyslexia/trunk/dyslexia.asd
==============================================================================
--- (empty file)
+++ dyslexia/trunk/dyslexia.asd Sun Apr 23 15:28:36 2006
@@ -0,0 +1,40 @@
+;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
+;;;
+;;; dyslexia.asd --- ASDF system definition for dyslexia.
+;;;
+;;; Copyright (C) 2006 Luis Oliveira <loliveira at common-lisp.net>
+;;;
+;;; Permission is hereby granted, free of charge, to any person
+;;; obtaining a copy of this software and associated documentation
+;;; files (the "Software"), to deal in the Software without
+;;; restriction, including without limitation the rights to use, copy,
+;;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;;; of the Software, and to permit persons to whom the Software is
+;;; furnished to do so, subject to the following conditions:
+;;;
+;;; The above copyright notice and this permission notice shall be
+;;; included in all copies or substantial portions of the Software.
+;;;
+;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+;;; DEALINGS IN THE SOFTWARE.
+
+(defpackage #:dyslexia-system
+ (:use #:cl #:asdf))
+(in-package #:dyslexia-system)
+
+(defsystem dyslexia
+ :description "A spell checker."
+ :author "Robert Strandh"
+ :version "0.1.0"
+ :licence "MIT"
+ :components
+ ((:file "package")
+ (:file "spell" :depends-on ("package"))))
+
+;; vim: ft=lisp et
Added: dyslexia/trunk/package.lisp
==============================================================================
--- (empty file)
+++ dyslexia/trunk/package.lisp Sun Apr 23 15:28:36 2006
@@ -0,0 +1,34 @@
+;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
+;;;
+;;; package.lisp --- Package definition for dyslexia.
+;;;
+;;; Copyright (C) 2006 Luis Oliveira <loliveira at common-lisp.net>
+;;;
+;;; Permission is hereby granted, free of charge, to any person
+;;; obtaining a copy of this software and associated documentation
+;;; files (the "Software"), to deal in the Software without
+;;; restriction, including without limitation the rights to use, copy,
+;;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;;; of the Software, and to permit persons to whom the Software is
+;;; furnished to do so, subject to the following conditions:
+;;;
+;;; The above copyright notice and this permission notice shall be
+;;; included in all copies or substantial portions of the Software.
+;;;
+;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+;;; DEALINGS IN THE SOFTWARE.
+
+(in-package #:cl-user)
+
+(defpackage #:dyslexia
+ (:use #:common-lisp)
+ ;; FIXME: For now, export just this until I understand what protocol
+ ;; is to be exported.
+ (:export #:lookup
+ #:insert))
Modified: dyslexia/trunk/spell.lisp
==============================================================================
--- dyslexia/trunk/spell.lisp (original)
+++ dyslexia/trunk/spell.lisp Sun Apr 23 15:28:36 2006
@@ -1,3 +1,31 @@
+;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
+;;;
+;;; spell.lisp --- Spell checker.
+;;;
+;;; Copyright (C) 2006 Robert Strandh <strandh at labri.fr>
+;;;
+;;; Permission is hereby granted, free of charge, to any person
+;;; obtaining a copy of this software and associated documentation
+;;; files (the "Software"), to deal in the Software without
+;;; restriction, including without limitation the rights to use, copy,
+;;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;;; of the Software, and to permit persons to whom the Software is
+;;; furnished to do so, subject to the following conditions:
+;;;
+;;; The above copyright notice and this permission notice shall be
+;;; included in all copies or substantial portions of the Software.
+;;;
+;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+;;; DEALINGS IN THE SOFTWARE.
+
+(in-package #:dyslexia)
+
(defgeneric lookup (string dictionary))
(defgeneric insert (object string dictionary))
@@ -14,8 +42,8 @@
(defgeneric %lookup (string suffix node)
(:method (string suffix node)
- (declare (ignore string suffix node))
- '()))
+ (declare (ignore string suffix node))
+ '()))
(defclass leaf-mixin ()
((%entries :initform '() :initarg :entries :accessor entries)))
@@ -33,10 +61,10 @@
(defmethod %lookup (string suffix (node interior-mixin))
(let ((child (find-child (aref string (- (length string) suffix))
- (children node))))
+ (children node))))
(if (null child)
- nil
- (%lookup string (1- suffix) child))))
+ nil
+ (%lookup string (1- suffix) child))))
(defclass leaf-node (leaf-mixin) ())
(defclass interior-leaf-node (interior-mixin leaf-mixin) ())
@@ -64,13 +92,13 @@
(defmethod %insert (object string suffix (node interior-mixin))
(let ((child (find-child (aref string (- (length string) suffix))
- (children node))))
+ (children node))))
(when (null child)
(setf child (make-instance 'node))
(setf (children node)
- (add-child child
- (aref string (- (length string) suffix))
- (children node))))
+ (add-child child
+ (aref string (- (length string) suffix))
+ (children node))))
(%insert object string (1- suffix) child)))
(defmethod insert (object string (dictionary dictionary))
@@ -91,14 +119,14 @@
(defmethod add-child (node char (entries vector))
(setf (aref entries (- (char-code char) #.(char-code #\a)))
- node))
+ node))
(defparameter *word-types* (make-hash-table :test #'eq))
(defmacro defword (class-name &body body)
(let ((type (intern (symbol-name class-name) :keyword)))
`(progn (setf (gethash ,type *word-types*) ',class-name)
- (defclass ,class-name , at body))))
+ (defclass ,class-name , at body))))
(defword word ()
((%spelling :initarg :spelling :reader spelling)
@@ -109,7 +137,7 @@
(%case :initarg :case :initform :nominative :reader %case)
(%gender :initarg :gender :initform :any :reader gender)
(%singular :initarg :singular :reader singular)))
-
+
(defword proper-noun (noun) ())
(defword negative-mixin ()
@@ -182,7 +210,7 @@
(defun word (&rest arguments &key type spelling &allow-other-keys)
(insert (apply #'make-instance
- (gethash type *word-types*)
- (progn (remf arguments :type) arguments))
- spelling
- *english-dictionary*))
+ (gethash type *word-types*)
+ (progn (remf arguments :type) arguments))
+ spelling
+ *english-dictionary*))
More information about the Dyslexia-cvs
mailing list