Contents    Page-10    Prev    Next    Page+10    Index   

Word Category Testing


;   Test if current word is in category
; (wordcat 'month)  where atnword = oct
(defn wordcat [category]
  (if (= category 'number)
      (and (number? atnword) atnword)
      (if (= category 'symbol)
          (and (symbol? atnword) atnword)
          (let [catlst (assocl category lexicon)
                wd (findwd atnword (second catlst))]
            (if (cons? wd)
                (if (empty? (rest wd))
                    (first wd)
                    (second wd))
                wd) ))))

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 (not implemented).