(FILECREATED "11-Oct-88 17:30:41" {ERINYES}<LISPUSERS>KOTO>SEARCHMENU.;6 27345  

      changes to:  (FNS SearchMenu.MatchWords)

      previous date: " 2-Aug-88 16:58:59" {ERINYES}<LISPUSERS>KOTO>SEARCHMENU.;5)


(* Copyright (c) 1987, 1988 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT SEARCHMENUCOMS)

(RPAQQ SEARCHMENUCOMS ((COMS * SEARCHMENUDEPENDENCIES)
	(FILES DICTTOOL ANALYZER FREEMENU (FROM {QV}<DICTSERVER>LISP>)
	       DICTCLIENT)
	(INITVARS SearchMenu SearchMenu.Stream (SearchMenu.Cutoff 39))
	(FNS SearchMenu.Create SearchMenu.GetData SearchMenu.PrintData SearchMenu.PrintDef 
	     SearchMenu.PrintSearch SearchMenu.ToggleKey SearchMenu.ToggleSample SearchMenu.PrintUses 
	     SearchMenu.Clear SearchMenu.MatchWords SearchMenu.MatchKeys SearchMenu.SearchFn 
	     SearchMenu.SetDatabase SearchMenu.DeleteKey SearchMenu.DeleteKeys)
	(FNS TEdit.MatchWords DictTool.MatchWords)
	(VARS SearchKey SearchDelete SearchMatch SearchPrint SearchDatabase SearchClear SearchUses 
	      SearchDef SearchSample SearchExamples SearchMatchKeys)
	(P (SearchMenu.Create))))

(RPAQQ SEARCHMENUDEPENDENCIES [(* * code to make sure that the right versions of everything are 
				    loaded. The P must be executed before any FILES commands.)
				 [E (PUTPROP (QUOTE SEARCHMENU)
					     (QUOTE DEPENDENCIES)
					     (for FILE in (FILECOMSLST (QUOTE SEARCHMENU)
								       (QUOTE FILES))
						  collect
						  (CONS FILE (CAAR (GETPROP FILE (QUOTE FILEDATES]
				 (PROP DEPENDENCIES SEARCHMENU)
				 (P (for FILE FILEDATE in (GETPROP (QUOTE SEARCHMENU)
								   (QUOTE DEPENDENCIES))
					 do
					 [SETQ FILEDATE (CAAR (GETPROP (CAR FILE)
								       (QUOTE FILEDATES]
					 (COND ([AND FILEDATE (CDR FILE)
						     (ILESSP (IDATE FILEDATE)
							     (IDATE (CDR FILE]
						(* clear FILEDATES to force FILESLOAD to reload the 
						   file.)
						(PUTPROP (CAR FILE)
							 (QUOTE FILEDATES)
							 NIL])
(* * code to make sure that the right versions of everything are loaded. The P must be 
executed before any FILES commands.)


(PUTPROPS SEARCHMENU DEPENDENCIES ((DICTTOOL . " 2-Aug-88 17:00:05")
				     (ANALYZER . " 3-Jun-88 17:03:38")
				     (FREEMENU . " 7-Sep-85 23:17:28")
				     (DICTCLIENT . " 8-Aug-88 16:01:50")))
[for FILE FILEDATE in (GETPROP (QUOTE SEARCHMENU)
			       (QUOTE DEPENDENCIES))
     do
     [SETQ FILEDATE (CAAR (GETPROP (CAR FILE)
				   (QUOTE FILEDATES]
     (COND ([AND FILEDATE (CDR FILE)
		 (ILESSP (IDATE FILEDATE)
			 (IDATE (CDR FILE]
	    (* clear FILEDATES to force FILESLOAD to reload the file.)
	    (PUTPROP (CAR FILE)
		     (QUOTE FILEDATES)
		     NIL]
(FILESLOAD DICTTOOL ANALYZER FREEMENU (FROM {QV}<DICTSERVER>LISP>)
	   DICTCLIENT)

(RPAQ? SearchMenu NIL)

(RPAQ? SearchMenu.Stream NIL)

(RPAQ? SearchMenu.Cutoff 39)
(DEFINEQ

(SearchMenu.Create
  [LAMBDA (MATCHES KEYWEIGHTS KEYMENU CLEAR)                 (* "w.a.l.johnson" "30-Nov-87 10:02")
                                                             (* "w.a.l.johnson" "11-Nov-87 17:16")
                                                             (* jtm: "30-Oct-87 15:39")
    (LET (REGION EXAMPLES SEARCHMENUDATA POSWORDS NEGWORDS NEGKEYS MISSINGWORDS MENUTYPE)
         (COND
	   (SearchMenu (SETQ REGION (WINDOWPROP SearchMenu (QUOTE REGION)))
		       (SETQ SEARCHMENUDATA (AND (NOT CLEAR)
						     (SearchMenu.GetData SearchMenu)))
		       [OR KEYWEIGHTS (SETQ KEYWEIGHTS (LISTGET SEARCHMENUDATA (QUOTE 
										       KEYWEIGHTS]
		       [OR MATCHES (SETQ MATCHES (LISTGET SEARCHMENUDATA (QUOTE MATCHES]
		       (SETQ POSWORDS (LISTGET SEARCHMENUDATA (QUOTE POSWORDS)))
		       (SETQ NEGWORDS (LISTGET SEARCHMENUDATA (QUOTE NEGWORDS)))
		       (SETQ NEGKEYS (LISTGET SEARCHMENUDATA (QUOTE NEGKEYS)))
		       (SETQ EXAMPLES (LISTGET SEARCHMENUDATA (QUOTE EXAMPLES)))
		       (CLOSEW SearchMenu)))
         [SETQ MENUTYPE (COND
	     (KEYMENU (QUOTE KEYMENU))
	     (T (QUOTE SAMPLEMENU]
         (COND
	   ((NULL SEARCHMENUDATA)
	     (SETQ SEARCHMENUDATA (LIST (QUOTE MENUTYPE)
					    MENUTYPE)))
	   (T (LISTPUT SEARCHMENUDATA (QUOTE MENUTYPE)
			 MENUTYPE)))
         (LISTPUT SEARCHMENUDATA (QUOTE KEYWEIGHTS)
		    KEYWEIGHTS)
         (LISTPUT SEARCHMENUDATA (QUOTE MATCHES)
		    MATCHES)
         [OPENW (SETQ SearchMenu
		    (FM.FORMATMENU (APPEND [BQUOTE ((WINDOWPROPS TITLE "Search Menu" LEFT ,
								       (OR (AND REGION
										    (CAR REGION))
									     0)
								       BOTTOM ,
								       (OR (AND REGION
										    (CADR REGION))
									     0]
					       [COND
						 [KEYMENU (BQUOTE (((LABEL (\, SearchSample)
									     SELECTEDFN 
									  SearchMenu.ToggleSample)
								      (LABEL (\, SearchMatchKeys)
									     SELECTEDFN 
									     SearchMenu.MatchKeys)
								      (LABEL (\, SearchPrint)
									     SELECTEDFN 
									   SearchMenu.PrintSearch)
								      (LABEL (\, SearchDatabase)
									     SELECTEDFN 
									   SearchMenu.SetDatabase)
								      (LABEL (\, SearchClear)
									     SELECTEDFN 
									     SearchMenu.Clear]
						 (T (BQUOTE (((LABEL (\, SearchKey)
								       SELECTEDFN 
								       SearchMenu.ToggleKey)
								(LABEL (\, SearchMatch)
								       SELECTEDFN 
								       SearchMenu.MatchWords)
								(LABEL (\, SearchPrint)
								       SELECTEDFN 
								       SearchMenu.PrintSearch)
								(LABEL (\, SearchDelete)
								       SELECTEDFN 
								       SearchMenu.DeleteKeys)
								(LABEL (\, SearchDatabase)
								       SELECTEDFN 
								       SearchMenu.SetDatabase)
								(LABEL (\, SearchClear)
								       SELECTEDFN SearchMenu.Clear))
							       ((TYPE EDITSTART LABEL (\, 
										   SearchExamples)
								      ITEMS
								      (EXAMPLES))
								(TYPE EDIT ID EXAMPLES LABEL ,
								      (OR EXAMPLES ""]
					       (COND
						 [KEYMENU 

          (* (TYPE 3STATE LABEL , (CONCAT (CAR KEY) ":") STATE , (COND ((MEMBER (CAR KEY) NEGKEYS) NIL) 
	  (T (QUOTE NEUTRAL)))))


							  (for KEY ID in KEYWEIGHTS
							     collect
							      (BQUOTE ((LABEL (\, SearchUses)
										ID ,
										(COPYSTRING
										  (CAR KEY))
										SELECTEDFN 
									     SearchMenu.PrintUses)
									 (TYPE EDITSTART LABEL ,
									       (CONCAT
										 (CAR KEY)
										 ":")
									       ITEMS ,
									       (LIST (CAR KEY)))
									 (TYPE EDIT ID ,
									       (CAR KEY)
									       LABEL , (CADR KEY]
						 (T (for MATCH ID inside MATCHES
						       collect
							(SETQ ID (COND
							    ((LISTP MATCH)
							      (CAR MATCH))
							    (T MATCH)))
							[COND
							  ((AND (LISTP MATCH)
								  (NTH (CADDR MATCH)
									 5))
							    (RPLACD (NTH (CADDR MATCH)
									     5)
								      (LIST "..."]
							(BQUOTE ((LABEL (\, SearchDef)
									  ID , (COPYSTRING ID)
									  SELECTEDFN 
									  SearchMenu.PrintDef)
								   (TYPE 3STATE ID , ID LABEL ,
									 (MKSTRING MATCH)
									 STATE ,
									 (COND
									   ((MEMBER ID POSWORDS)
									     T)
									   ((MEMBER ID NEGWORDS)
									     NIL)
									   (T (QUOTE NEUTRAL]
         (COND
	   ((SETQ MISSINGWORDS (AND MATCHES (for KEY in POSWORDS
						   when [NOT (COND
								   ((LISTP (CAR MATCHES))
								     (SASSOC KEY MATCHES))
								   (T (MEMBER KEY MATCHES]
						   collect KEY)))
	     (PROMPTPRINT "Lost keys: " MISSINGWORDS)
	     (FLASHW PROMPTWINDOW)
	     (SETQ POSWORDS (LDIFFERENCE POSWORDS MISSINGWORDS))
	     (LISTPUT SEARCHMENUDATA (QUOTE POSWORDS)
			POSWORDS)))
         (WINDOWPROP SearchMenu (QUOTE SEARCHMENUDATA)
		       SEARCHMENUDATA])

(SearchMenu.GetData
  [LAMBDA (WINDOW)                                           (* jtm: "30-Oct-87 15:55")
    (LET (STATE SEARCHMENUDATA KEYWEIGHTS EXAMPLES MATCHES POSWORDS NEGWORDS)
         (SETQ STATE (FM.READSTATE WINDOW))
         (SETQ SEARCHMENUDATA (WINDOWPROP WINDOW (QUOTE SEARCHMENUDATA)))
         (COND
	   ((EQ (QUOTE KEYMENU)
		  (LISTGET SEARCHMENUDATA (QUOTE MENUTYPE)))
	     (SETQ KEYWEIGHTS (for TAIL WEIGHT on STATE by (CDDR TAIL)
				   when (AND TAIL (STRINGP (CAR TAIL))
						 [NUMBERP (SETQ WEIGHT (MKATOM (CADR TAIL]
						 (NOT (ZEROP WEIGHT)))
				   collect (LIST (CAR TAIL)
						     WEIGHT)))
	     (LISTPUT SEARCHMENUDATA (QUOTE KEYWEIGHTS)
			KEYWEIGHTS))
	   (T (SETQ EXAMPLES (LISTGET STATE (QUOTE EXAMPLES)))
	      (LISTPUT SEARCHMENUDATA (QUOTE EXAMPLES)
			 EXAMPLES)
	      (SETQ POSWORDS (LISTGET SEARCHMENUDATA (QUOTE POSWORDS)))
	      (for WORD in (PARSEBYCOLONS EXAMPLES) do (push POSWORDS WORD))
	      (SETQ MATCHES (LISTGET SEARCHMENUDATA (QUOTE MATCHES)))
	      [for MATCH KEY in MATCHES
		 do (SETQ KEY (COND
			  ((LISTP MATCH)
			    (CAR MATCH))
			  (T MATCH)))
		      (SELECTQ (LISTGET STATE KEY)
				 (T (AND (NOT (MEMBER KEY POSWORDS))
					   (push POSWORDS KEY)))
				 (NEUTRAL)
				 (push NEGWORDS KEY)
				 (COND
				   ((MEMBER KEY POSWORDS)
				     (SETQ POSWORDS (REMOVE KEY POSWORDS]
	      (LISTPUT SEARCHMENUDATA (QUOTE POSWORDS)
			 (INTERSECTION POSWORDS POSWORDS))
	      (LISTPUT SEARCHMENUDATA (QUOTE NEGWORDS)
			 NEGWORDS)))
     SEARCHMENUDATA])

(SearchMenu.PrintData
  [LAMBDA (STREAM POSWORDS NEGWORDS KEYS MATCHES)            (* jtm: "28-Oct-87 15:17")
    (OR STREAM (SETQ STREAM (OPENTEXTSTREAM)))
    (COND
      ((AND (BOUNDP (QUOTE SquareSampleFreq))
	      (BOUNDP (QUOTE InvertedDict.MinimumMatches)))
	(printout STREAM "(" InvertedDict.MinimumMatches " min, " (COND
		    (SquareSampleFreq "")
		    (T "not"))
		  " squared)")))
    (printout STREAM "***" "SEARCH MENU PRINTED ON " (DATE)
	      "***" T T)
    (COND
      (POSWORDS (printout STREAM "SELECTED WORDS: ")
		[for TAIL on POSWORDS do (printout STREAM (CAR TAIL)
							 (COND
							   ((CDR TAIL)
							     "; ")
							   (T ""]
		(printout STREAM T)))
    (COND
      (NEGWORDS (printout STREAM "IGNOREDKEYS: ")
		[for TAIL on NEGWORDS do (printout STREAM (CAR TAIL)
							 (COND
							   ((CDR TAIL)
							     "; ")
							   (T ""]
		(printout STREAM T)))
    (printout STREAM T "KEY WEIGHTS:" T)
    (for KEY in KEYS do (printout STREAM .FR 6 (CADR KEY)
					,
					(CAR KEY)
					T))
    (printout STREAM T "MATCHES:" T)
    (for MATCH in MATCHES
       do [COND
	      ((NTH (CADDR MATCH)
		      5)
		(RPLACD (NTH (CADDR MATCH)
				 5)
			  (LIST "..."]
	    (printout STREAM .FR 6 (CADR MATCH)
		      ,
		      (CAR MATCH)
		      ,
		      (CADDR MATCH)
		      T))
    (printout STREAM T)
    STREAM])

(SearchMenu.PrintDef
  [LAMBDA (ITEM WINDOW BUTTONS)                              (* jtm: "13-Oct-87 14:13")
    (LET (WORD NERD DICT)
         (SETQ WORD (FM.ITEMPROP ITEM (QUOTE ID)))
         [AND (SETQ NERD (NerdForStream SearchMenu.Stream))
		(SETQ DICT (InvertedDict.Prop NERD (QUOTE DICTIONARY]
         (TEdit.PrintDefinition NIL DICT WORD])

(SearchMenu.PrintSearch
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* jtm: "28-Oct-87 14:43")
    (LET (SEARCHMENUDATA POSWORDS NEGWORDS KEYWEIGHTS MATCHES SCRATCH)
         (SETQ SEARCHMENUDATA (SearchMenu.GetData WINDOW))
         (SETQ POSWORDS (LISTGET SEARCHMENUDATA (QUOTE POSWORDS)))
         (SETQ NEGWORDS (LISTGET SEARCHMENUDATA (QUOTE NEGWORDS)))
         (SETQ KEYWEIGHTS (LISTGET SEARCHMENUDATA (QUOTE KEYWEIGHTS)))
         (SETQ MATCHES (LISTGET SEARCHMENUDATA (QUOTE MATCHES)))
         (SETQ SCRATCH (SearchMenu.PrintData NIL POSWORDS NEGWORDS KEYWEIGHTS MATCHES))
         (TEDIT.INCLUDESTREAM (Dict.OutputStream)
				SCRATCH)
         (CLOSEF SCRATCH])

(SearchMenu.ToggleKey
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "11-Nov-87 15:57")
                                                             (* jtm: " 9-Oct-87 10:46")
    (SearchMenu.GetData WINDOW)
    (SearchMenu.Create NIL NIL T])

(SearchMenu.ToggleSample
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "11-Nov-87 16:00")
                                                             (* jtm: " 9-Oct-87 10:46")
    (SearchMenu.GetData WINDOW)
    (SearchMenu.Create NIL NIL NIL NIL])

(SearchMenu.PrintUses
  [LAMBDA (ITEM WINDOW BUTTONS)                              (* jtm: "13-Oct-87 10:11")
    (LET (WORD)
         (SETQ WORD (FM.ITEMPROP ITEM (QUOTE ID)))
         (TEdit.PrintSearch NIL (NerdForStream SearchMenu.Stream)
			      WORD])

(SearchMenu.Clear
  [LAMBDA (ITEM WINDOW BUTTONS)                              (* "w.a.l.johnson" "11-Nov-87 15:58")
                                                             (* jtm: "28-Oct-87 14:17")
    (SearchMenu.Create NIL NIL NIL T])

(SearchMenu.MatchWords
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "11-Nov-87 15:58")
                                                             (* jtm: "11-Oct-88 10:00")
    (LET (SEARCHMENUDATA POSWORDS NEGKEYS MATCHES NERD MATCHWORDSFN (STARTTIME (CLOCK 0)))
         (SETQ SEARCHMENUDATA (SearchMenu.GetData WINDOW))
         (SETQ POSWORDS (LISTGET SEARCHMENUDATA (QUOTE POSWORDS)))
         (SETQ NEGKEYS (LISTGET SEARCHMENUDATA (QUOTE NEGKEYS)))
         (SETQ NERD (SearchMenu.SetDatabase NIL WINDOW))
         (PROMPTPRINT "Searching in " (InvertedDict.Name NERD)
			" for words like: " POSWORDS (COND
			  (NEGKEYS (CONCAT ", ignoring the keys: " NEGKEYS))
			  (T "")))
         [SETQ MATCHES (COND
	     ([SETQ MATCHWORDSFN (OR (InvertedDict.Prop NERD (QUOTE RELEVANCESEARCHFN))
					 (InvertedDict.Prop NERD (QUOTE MATCHWORDSFN]
	       (APPLY* MATCHWORDSFN NERD POSWORDS NEGKEYS 0 SearchMenu.Cutoff))
	     (T (DICTCLIENT.MATCHWORDS POSWORDS NEGKEYS 0 SearchMenu.Cutoff (InvertedDict.Prop
					   NERD
					   (QUOTE RemoteDict]
         (PROMPTPRINT "Search time: " (QUOTIENT (IDIFFERENCE (CLOCK 0)
								   STARTTIME)
						    1000.0)
			" seconds.")
         (SearchMenu.Create (CADR MATCHES)
			      (CAR MATCHES])

(SearchMenu.MatchKeys
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "11-Nov-87 16:08")
                                                             (* jtm: "28-Oct-87 14:22")
    (LET (SEARCHMENUDATA MATCHES KEYWEIGHTS NERD WEIGHTSEARCHFN (STARTTIME (CLOCK 0)))
         (SETQ SEARCHMENUDATA (SearchMenu.GetData WINDOW))
         (SETQ KEYWEIGHTS (LISTGET SEARCHMENUDATA (QUOTE KEYWEIGHTS)))
         (SETQ NERD (SearchMenu.SetDatabase NIL WINDOW))
         (PROMPTPRINT "Searching on keys: " KEYWEIGHTS)
         [SETQ MATCHES (COND
	     ((SETQ WEIGHTSEARCHFN (InvertedDict.Prop NERD (QUOTE WEIGHTSEARCHFN)))
	       (APPLY* WEIGHTSEARCHFN NERD KEYWEIGHTS 0 SearchMenu.Cutoff))
	     (T (DICTCLIENT.WEIGHTEDSEARCH KEYWEIGHTS 0 SearchMenu.Cutoff (InvertedDict.Prop
					       NERD
					       (QUOTE RemoteDict]
         (PROMPTPRINT "Search time: " (QUOTIENT (IDIFFERENCE (CLOCK 0)
								   STARTTIME)
						    1000.0)
			" seconds.")
         (SearchMenu.Create (CADR MATCHES)
			      (CAR MATCHES])

(SearchMenu.SearchFn
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* jtm: "25-Sep-87 16:37")
    (LET (KEYS SEARCHRESULT)
         (SETQ KEYS (LISTGET (FM.READSTATE WINDOW)
				 (QUOTE SearchKeys)))
         (SETQ SEARCHRESULT (InvertedDict.WeightedSearch WordNerd KEYS))
         (RPLACD (NTH SEARCHRESULT SearchMenu.Cutoff))
         (SearchMenu.Create SEARCHRESULT])

(SearchMenu.SetDatabase
  [LAMBDA (MENUITEM WINDOW BUTTONS)                        (* jtm: "30-Nov-87 11:32")
    [COND
      ((NULL SearchMenu.Stream)
	(SETQ SearchMenu.Stream (OPENTEXTSTREAM]
    (COND
      [(NULL MENUITEM)                                     (* called by SearchMenu.MatchWords and 
							     SearchMenu.MatchKeys)
	(COND
	  ((STREAMPROP SearchMenu.Stream (QUOTE nerd)))
	  (T (TEdit.SetNerd SearchMenu.Stream]
      (T (TEdit.SetNerd SearchMenu.Stream])

(SearchMenu.DeleteKey
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "30-Nov-87 10:27")
                                                             (* jtm: "30-Oct-87 16:04")
    (LET (SEARCHMENUDATA POSWORDS KEYWEIGHTS NEGKEYS NEGKEY)
         (SETQ SEARCHMENUDATA (SearchMenu.GetData WINDOW))
         (SETQ NEGKEYS (LISTGET SEARCHMENUDATA (QUOTE NEGKEYS)))
         (SETQ KEYWEIGHTS (LISTGET SEARCHMENUDATA (QUOTE KEYWEIGHTS)))
         (PROG NIL
	     LP  (COND
		   ((SETQ NEGKEY (MENU (create MENU
						     TITLE ← "key to delete:"
						     ITEMS ← (for KEYWEIGHT in KEYWEIGHTS
								  unless (MEMBER (CAR KEYWEIGHT)
										     NEGKEYS)
								  collect
								   (LIST (CONCAT (CAR KEYWEIGHT)
										     ": " "("
										     (CADR 
											KEYWEIGHT)
										     ")")
									   (CAR KEYWEIGHT)))
						     CENTERFLG ← T)))
		     (pushnew NEGKEYS NEGKEY)
		     (LISTPUT SEARCHMENUDATA (QUOTE NEGKEYS)
				NEGKEYS)
		     (GO LP])

(SearchMenu.DeleteKeys
  [LAMBDA (MENUITEM WINDOW BUTTONS)                          (* "w.a.l.johnson" "30-Nov-87 10:27")
                                                             (* "w.a.l.johnson" "30-Nov-87 10:10")
                                                             (* jtm: "30-Oct-87 16:04")
    (LET (SEARCHMENUDATA POSWORDS KEYWEIGHTS NEGKEYS NEGKEY)
         (SETQ SEARCHMENUDATA (SearchMenu.GetData WINDOW))
         (SETQ NEGKEYS (LISTGET SEARCHMENUDATA (QUOTE NEGKEYS)))
         (SETQ KEYWEIGHTS (LISTGET SEARCHMENUDATA (QUOTE KEYWEIGHTS)))
         (PROG NIL
	     LP  (COND
		   ((SETQ NEGKEY (MENU (create MENU
						     TITLE ← "key to delete:"
						     ITEMS ← (for KEYWEIGHT in KEYWEIGHTS
								  unless (MEMBER (CAR KEYWEIGHT)
										     NEGKEYS)
								  collect
								   (LIST (CONCAT (CAR KEYWEIGHT)
										     ": " "("
										     (CADR 
											KEYWEIGHT)
										     ")")
									   (CAR KEYWEIGHT)))
						     CENTERFLG ← T)))
		     (pushnew NEGKEYS NEGKEY)
		     (LISTPUT SEARCHMENUDATA (QUOTE NEGKEYS)
				NEGKEYS)
		     (GO LP])
)
(DEFINEQ

(TEdit.MatchWords
  [LAMBDA (stream dict words)                                (* jtm: "28-Sep-87 15:17")

          (* * prints out the definitions that have a particular phrase in them.)


    (OR stream (SETQ stream (Dict.OutputStream)))
    (DictTool.TEditWrapper (NerdForStream stream)
			     (FUNCTION DictTool.MatchWords)
			     stream words "Type sample words:" "Searching for words like"
			     (QUOTE SAMPLEWORDS])

(DictTool.MatchWords
  [LAMBDA (dict selection stream)                            (* jtm: " 9-Oct-87 13:43")
    (LET (looks words fn pos)
         [SETQ words (CADR (COND
				 ((SETQ fn (InvertedDict.Prop dict (QUOTE MATCHWORDSFN)))
				   (APPLY* fn dict selection))
				 ((InvertedDict.Prop dict (QUOTE RemoteDict))
				   (DICTCLIENT.MATCHWORDS (PARSEBYCOLONS selection)
							    NIL NIL NIL (InvertedDict.Prop
							      dict
							      (QUOTE RemoteDict]
         (SETQ pos (TEDIT.GETPOINT stream))
         (TEDIT.INSERT stream (CONCAT selection ": "))
         (SETQ looks (CONS pos (IDIFFERENCE (TEDIT.GETPOINT stream)
						  pos)))
         [for tail on words do (TEDIT.INSERT stream (CONCAT (CAR (CAR tail))
								      (COND
									((CDR tail)
									  "; ")
									(T ""]
         (TEDIT.INSERT stream (CHARACTER (CHARCODE CR)))
         (TEDIT.INSERT stream (CHARACTER (CHARCODE CR)))
                                                             (* do the looks last to avoid messing up the text 
							     placement.)
         (TEDIT.LOOKS stream (QUOTE (FAMILY TIMESROMAN SIZE 10 FACE STANDARD))
			1
			(TEDIT.GETPOINT stream))
         (TEDIT.LOOKS stream (QUOTE (FAMILY HELVETICA SIZE 10 FACE BOLD))
			(CAR looks)
			(CDR looks))
     words])
)

(RPAQ SearchKey (READBITMAP))
(64 23
"COOOOOOOOOOOOOO@"
"GOOOOOOOOOOOOOOH"
"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OOOOOOOOOOOD@"
"CBJJJJJJJJJJJJJJJKL@"
"AMEEEEEEEEEEEEEEEEH@"
"@OOOOOOOOOOOOOOOOO@@")
(SearchMenu.Create)
(PUTPROPS SEARCHMENU COPYRIGHT ("Xerox Corporation" 1987 1988))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (2847 19786 (SearchMenu.Create 2857 . 8190) (SearchMenu.GetData 8192 . 10000) (
SearchMenu.PrintData 10002 . 11531) (SearchMenu.PrintDef 11533 . 11930) (SearchMenu.PrintSearch 11932
 . 12705) (SearchMenu.ToggleKey 12707 . 13002) (SearchMenu.ToggleSample 13004 . 13308) (
SearchMenu.PrintUses 13310 . 13596) (SearchMenu.Clear 13598 . 13857) (SearchMenu.MatchWords 13859 . 
15282) (SearchMenu.MatchKeys 15284 . 16437) (SearchMenu.SearchFn 16439 . 16864) (
SearchMenu.SetDatabase 16866 . 17406) (SearchMenu.DeleteKey 17408 . 18543) (SearchMenu.DeleteKeys 
18545 . 19784)) (19787 21735 (TEdit.MatchWords 19797 . 20264) (DictTool.MatchWords 20266 . 21733)))))
STOP