(FILECREATED " 8-Aug-84 12:37:43" {ERIS}<SPEECH>HALVORSEN>PARSE-LEX.;7 5023
changes to: (VARS PARSE-LEXCOMS TEMPARRAY)
(FNS REORDER-STRESS-INFO PARSE-LEX-ARRAY)
previous date: " 8-Aug-84 11:55:48" {ERIS}<SPEECH>HALVORSEN>PARSE-LEX.;5)
(* Copyright (c) 1984 by Xerox Corporation. All rights reserved.)
(PRETTYCOMPRINT PARSE-LEXCOMS)
(RPAQQ PARSE-LEXCOMS [(FNS PARSE-LEX-ARRAY PARSE-WORD-RECORD LISTIFY.SYLLABIFICATION
REORDER-STRESS-INFO STRESS.TO.END)
(P (LOAD? (QUOTE {ERIS}<LISPUSERS>LOADFILES.DCOM)
(QUOTE SYSLOAD))
(LOADFILES (QUOTE (NIL {ERIS}<SPEECH>LEXICON))
(QUOTE (NLOAD DFOOT))
(QUOTE (DCOM NIL])
(DEFINEQ
(PARSE-LEX-ARRAY
[LAMBDA (ARRAY) (* pkh: " 8-Aug-84 11:55")
(* Takes as input an array of entries from Webster's pocket dictionary; modifies the pronunciation to exhibit foot
structure, and prints out the modified pronunciation on FOOTOUTPUTFILE, which is a global variable)
(for I WREC [BITTBL ← (MAKEBITTABLE (QUOTE (- < *]
TEMP from 1 to (ARRAYSIZE ARRAY)
do (SETQ TEMP (ELT ARRAY I)) (* Get a line from the dictionary)
(SETQ WREC (create WORD
INPUT ← (fetch (LEXENTRY ORTH) of TEMP)))
(* Create a WORD record which the foot-parser knows about; the array with dictionary entries are LEXENTRY records;
ORTH of a LEXENTRY is INPUT of a WORD record; PRON of a LEXENTRY is the STRUCTURE field of a WORD record once the
pronunciation string in the dictionary has been turned into a list of lists of the segments in a syllable;
i.e. "men-tor" becomes ((m e n -) (t o r)))
(replace (WORD STRUCTURE) of WREC with (LISTIFY.SYLLABIFICATION (fetch (LEXENTRY PRON)
of TEMP)
BITTBL))
(PARSE-WORD-RECORD WREC) (* Foot parsing the WORD record)
(* Finally printing out the modified pronunciation)
(printout FOOTOUTPUTFILE (fetch INPUT of WREC)
.TAB 22 (PACKWORD (fetch STRUCTURE of WREC))
T])
(PARSE-WORD-RECORD
[LAMBDA (WREC) (* pkh: " 7-Aug-84 19:03")
(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 (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])
(LISTIFY.SYLLABIFICATION
[LAMBDA (PRON BITTBL) (* pkh: " 7-Aug-84 18:59")
(* 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 (REVERSE (push SYLLLIST (UNPACK (SUBSTRING PRON (ADD1 OLD-SEPR])
(REORDER-STRESS-INFO
[LAMBDA (WREC) (* pkh: " 8-Aug-84 12:18" posted: "29-Mar-82 16:46")
(* Iterate through all the syllables and put the stress
at the end)
(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])
)
(LOAD? (QUOTE {ERIS}<LISPUSERS>LOADFILES.DCOM)
(QUOTE SYSLOAD))
(LOADFILES (QUOTE (NIL {ERIS}<SPEECH>LEXICON))
(QUOTE (NLOAD DFOOT))
(QUOTE (DCOM NIL)))
(PUTPROPS PARSE-LEX COPYRIGHT ("Xerox Corporation" 1984))
(DECLARE: DONTCOPY
(FILEMAP (NIL (681 4775 (PARSE-LEX-ARRAY 691 . 2256) (PARSE-WORD-RECORD 2258 . 2999) (
LISTIFY.SYLLABIFICATION 3001 . 3698) (REORDER-STRESS-INFO 3700 . 4117) (STRESS.TO.END 4119 . 4773))))
)
STOP