(FILECREATED " 7-Aug-84 23:18:46" {ERIS}<SPEECH>LEXICON>KEEP>PARSE-LEX.;5 4828   

      changes to:  (VARS PARSE-LEXCOMS)

      previous date: " 7-Aug-84 22:12:45" {ERIS}<SPEECH>LEXICON>KEEP>PARSE-LEX.;3)


(* Copyright (c) 1984 by XEROX. All rights reserved.)

(PRETTYCOMPRINT PARSE-LEXCOMS)

(RPAQQ PARSE-LEXCOMS [(FNS PARSE-LEX-ARRAY PARSE-WORD-RECORD LISTIFY.SYLLABIFICATION 
			   REORDER-STRESS-INFO STRESS.TO.END)
		      (VARS TEMPARRAY)
		      (P (PROGN (LOAD (QUOTE NLOAD.DCOM))
				(LOAD (QUOTE DFOOT.DCOM])
(DEFINEQ

(PARSE-LEX-ARRAY
  [LAMBDA (ARRAY)                                            (* edited: " 7-Aug-84 21:47")
                                                             (* "Gumby" " 2-Aug-84 18:43")
                                                             (* CATEGORY is a filter on what words to parse)

          (* This is the top level-function of the foot and syllable-parsing system. We first CATEGORIZE the word 
	  (based on the presence of a string ".../CAT" at the end of the word); next, do a syllable parse 
	  (NEW-SYLLABLE-PARSER); finally do a foot-parse (PARSE-TEST); the global variable DEBUG controls the printout of 
	  information about the parse)


    (for I WREC [BITTBL ← (MAKEBITTABLE (QUOTE (- < *]
	 TEMP from 1 to (ARRAYSIZE ARRAY)
       do (SETQ TEMP (ELT ARRAY I))
	  (SETQ WREC (create WORD
			     INPUT ← (fetch (LEXENTRY ORTH) of TEMP)))
	  (replace (WORD STRUCTURE) of WREC with (LISTIFY.SYLLABIFICATION (fetch (LEXENTRY PRON)
									     of TEMP)
									  BITTBL))
	  (PARSE-WORD-RECORD WREC)
	  (printout FOOTOUTPUTFILE (fetch INPUT of WREC)
		    .TAB 22 (PACKWORD (fetch STRUCTURE of WREC))
		    T])

(PARSE-WORD-RECORD
  [LAMBDA (WREC)                                             (* pkh: " 6-Aug-84 16:53")
    (PROGN                                                   (* Takes word with syllables indicated by -, explodes 
							     the strings and puts them in reverse order under the 
							     property SYLLABLES)
	   (REORDER-STRESS-INFO WREC)
	   (replace STRUCTURE of WREC with (REVERSE (fetch STRUCTURE of WREC)))
                                                             (* Get the syllables in the correct order 
							     (left-to-right))
	   (COND
	     ((AND (NEQ (QUOTE NOBIND)
			(EVALV (QUOTE DEBUG)))
		   DEBUG)
	       (printout NIL T WREC T)))
	   (FOOT-PARSER WREC)
	   (FOOT.DOMAINS WREC])

(LISTIFY.SYLLABIFICATION
  [LAMBDA (PRON BITTBL)                                      (* pkh: " 7-Aug-84 15:02")
                                                             (* "Gumby" " 2-Aug-84 18:50")

          (* Turns a string with syllable boundary indicators into a list of lists (one list for each syllable) with the 
	  syllable separator as the last element of the list)


    (PROG ((OLD-SEPR 0))
          (RETURN (for (NEW-SEPR ← (STRPOSL BITTBL PRON 1))
		       SYLLLIST while NEW-SEPR by (STRPOSL BITTBL PRON (ADD1 NEW-SEPR))
		     do (push SYLLLIST (UNPACK (SUBSTRING PRON (ADD1 OLD-SEPR)
							  NEW-SEPR)))
			(SETQ OLD-SEPR NEW-SEPR)
		     finally (RETURN (push SYLLLIST (UNPACK (SUBSTRING PRON (ADD1 OLD-SEPR])

(REORDER-STRESS-INFO
  [LAMBDA (WREC)                                             (* pkh: " 3-Aug-84 21:10" posted: "29-Mar-82 16:46")

          (* Top-level function for stress-assignment. Takes a word (with the morphological information stripped off) and 
	  assigns stress to the syllables of the word according to the stress-rules. Outputs the word on the terminal and 
	  stores the stress-indication (PRINT-STRESSED-WORD))


    (for SYLL in (fetch (WORD STRUCTURE) of WREC) do (STRESS.TO.END SYLL) finally (RETURN WREC])

(STRESS.TO.END
  [LAMBDA (SYLLABLE.AS.LIST)                                 (* pkh: " 7-Aug-84 16:57")

          (* Takes a syllable, in the form of a list; if there is a stress indication, i.e. a number, then put it at the end
	  of the list)


    [COND
      ((SETQ STRESS (for SOUND in SYLLABLE.AS.LIST thereis (NUMBERP SOUND)))
	(DREMOVE STRESS SYLLABLE.AS.LIST)
	(COND
	  [(IGREATERP (LENGTH (LAST.BUT.NOT.SEPR SYLLABLE.AS.LIST))
		      1)
	    (RPLACD (NTH SYLLABLE.AS.LIST (SUB1 (LENGTH SYLLABLE.AS.LIST)))
		    (CONS STRESS (LAST SYLLABLE.AS.LIST]
	  (T (NCONC SYLLABLE.AS.LIST (LIST STRESS]
    SYLLABLE.AS.LIST])
)

(RPAQ TEMPARRAY (READARRAY 2 (QUOTE POINTER) 1))
(("abate" "x-b1et" 0)
("abate" "x-b1et" 0)
NIL
)
(PROGN (LOAD (QUOTE NLOAD.DCOM))
       (LOAD (QUOTE DFOOT.DCOM)))
(PUTPROPS PARSE-LEX COPYRIGHT ("XEROX" 1984))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (530 4594 (PARSE-LEX-ARRAY 540 . 1796) (PARSE-WORD-RECORD 1798 . 2573) (
LISTIFY.SYLLABIFICATION 2575 . 3358) (REORDER-STRESS-INFO 3360 . 3936) (STRESS.TO.END 3938 . 4592))))
)
STOP