Word Category Testing


;   Test if current word is in category
(defun cat (category) (get word category))

;   Define a lexicon.
;   Arg is list of (category ( items ))
;   Each item is word or (word value)
(defun deflexicon (lst)
  (dolist (l lst)
    (let ((category (car l)))
      (setf (part-of-speech category) t)
      (dolist (word (cadr l))
        (if (symbolp word)
            (setf (get word category) t)
            (setf (get (car word)
                       category)
                  (cadr word))) ) ) ) )

The lexicon and category testing can do multiple tasks:

  1. Test if a word has a specified part of speech.

  2. Translate to internal form, e.g.,
    March --> 3.

  3. Check for multi-word items, e.g., United States.

Contents    Page-10    Prev    Next    Page+10    Index