;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: LKB -*- (unless (lkb-version-after-p "2006/07/05 12:00:00") (error "this version of the ERG requires an LKB version >= 2006/07/05")) (set-coding-system utf-8) (time (progn #-(or :educ :openproof :mal) (lkb-load-lisp (parent-directory) "Version.lsp" t nil) #+:educ (lkb-load-lisp (parent-directory) "educ/Version-educ.lsp" t nil) #+:mal (lkb-load-lisp (parent-directory) "educ/Version-mal.lsp" t nil) #+:openproof (lkb-load-lisp (parent-directory) "openproof/Version-op.lsp" t nil) (setf *grammar-directory* (parent-directory)) (load-lkb-preferences (this-directory) "user-prefs.lsp") (lkb-load-lisp (this-directory) "globals.lsp" nil nil) (lkb-load-lisp (this-directory) "user-fns.lsp" nil nil) (lkb-load-lisp (this-directory) "checkpaths.lsp" t nil) (lkb-load-lisp (this-directory) "patches.lsp" t nil) (load-irregular-spellings (list (lkb-pathname (parent-directory) "irregs.tab") )) (read-tdl-type-files-aux (list (lkb-pathname (parent-directory) "fundamentals.tdl") (lkb-pathname (parent-directory) "tmt.tdl") (lkb-pathname (parent-directory) "lextypes.tdl") (lkb-pathname (parent-directory) "syntax.tdl") (lkb-pathname (parent-directory) "ctype.tdl") #+(or :educ :mal) (lkb-pathname (parent-directory) "educ/ctype-educ.tdl") (lkb-pathname (parent-directory) "lexrules.tdl") (lkb-pathname (parent-directory) "delims.tdl") ;(lkb-pathname (parent-directory) "dts.tdl") (lkb-pathname (parent-directory) "auxverbs.tdl") #+(or :educ :mal) (lkb-pathname (parent-directory) "educ/lextypes-educ.tdl") #+:openproof (lkb-pathname (parent-directory) "openproof/types-op.tdl") #+:openproof (lkb-pathname (parent-directory) "openproof/prorder.tdl") #+:mt (lkb-pathname (parent-directory) "mtr.tdl") #+:openproof (lkb-pathname (parent-directory) "openproof/mtr-op.tdl") ) (lkb-pathname (this-directory) "settings.lsp")) (read-cached-leaf-types-if-available (list (lkb-pathname (parent-directory) "letypes.tdl") #+:educ (lkb-pathname (parent-directory) "educ/letypes-mask.tdl") #+(or :educ :mal) (lkb-pathname (parent-directory) "educ/letypes-mal.tdl"))) #+(or :educ :mal :openproof) (setf *lexdb-params* nil) (if nil ;(and (boundp '*lexdb-params*) *lexdb-params*) (progn (load-lexdb-from-script) (read-cached-sublex-if-available "le" (list (lkb-pathname (parent-directory) "gle.tdl") (lkb-pathname (parent-directory) "ple.tdl")))) (read-cached-lex-if-available (list (lkb-pathname (parent-directory) "lexicon.tdl") (lkb-pathname (parent-directory) "ple.tdl") #+:educ (lkb-pathname (parent-directory) "educ/lexicon-mask.tdl") #+(or :educ :mal) (lkb-pathname (parent-directory) "educ/lexicon-mal.tdl") (lkb-pathname (parent-directory) "gle.tdl") #-(or :educ :mal) (lkb-pathname (parent-directory) "gle-gen.tdl") #+:openproof (lkb-pathname (parent-directory) "openproof/lex-openproof.tdl") ))) (read-tdl-grammar-file-aux (lkb-pathname (parent-directory) "constructions.tdl")) #+:educ (read-tdl-grammar-file-aux (lkb-pathname (parent-directory) "educ/constr-mask.tdl")) #+(or :educ :mal) (read-tdl-grammar-file-aux (lkb-pathname (parent-directory) "educ/constr-mal.tdl")) #+:openproof (read-tdl-grammar-file-aux (lkb-pathname (parent-directory) "openproof/constr-op.tdl")) (read-morph-file-aux (lkb-pathname (parent-directory) "inflr.tdl")) ; For ecommerce and vm, where e.g. period is used to end questions (read-tdl-psort-file-aux (lkb-pathname (parent-directory) "roots.tdl")) #+:openproof (read-tdl-psort-file-aux (lkb-pathname (parent-directory) "openproof/roots-op.tdl")) #-(or :educ :mal :openproof) (read-tdl-lex-rule-file-aux (lkb-pathname (parent-directory) "lexrinst.tdl")) #+:educ (read-tdl-lex-rule-file-aux (lkb-pathname (parent-directory) "educ/lexrinst-mask.tdl")) #+(or :educ :mal) (read-tdl-lex-rule-file-aux (lkb-pathname (parent-directory) "educ/lexrinst-mal.tdl")) ;; DPF 2020-06-14 - Until we get token-mapping support in the LKB, exclude ;; loading these mal-rules which depend on information from token-mapping: ;#+(or :educ :mal) ;(read-tdl-lex-rule-file-aux ; (lkb-pathname (parent-directory) "educ/lexrinst-tok.tdl")) #+:openproof (read-tdl-lex-rule-file-aux (lkb-pathname (parent-directory) "openproof/lexrinst.tdl")) ;; DPF 2020-06-06 - Comment out until token-mapping is supported, since the ;; following rules refer to token properties such as weak brackets that are ;; constrained in token mapping: ; (read-tdl-lex-rule-file-aux ; (lkb-pathname (parent-directory) "lexrinst-tok.tdl")) (read-tdl-parse-node-file-aux (lkb-pathname (parent-directory) "parse-nodes.tdl")) (lkb-load-lisp (this-directory) "mrsglobals.lsp" t nil) (lkb-load-lisp (this-directory) "eds.lsp" t nil) #+:tsdb (lkb-load-lisp (parent-directory "www") "setup.lsp" t nil) )) ;;; ;;; the Regular Expression Pre-Processor (REPP) is now broken up into quite a ;;; number of files. to ease re-use across the LKB and PET, keep the REPP ;;; configuration in a separate file. ;;; (lkb-load-lisp (parent-directory "rpp") "setup.lsp" t nil) ;;; ;;; when loaded into an environment including [incr tsdb()] and the Redwoods ;;; tools, also load a Maximum Entropy realization ranking model and activate ;;; selective unpacking (for generation). ;;; #+(and :tsdb :logon) (tsdb::read-model (lkb-pathname (parent-directory) "jhpstg.g.mem")) #+(and :tsdb :logon) (setf *unpacking-scoring-hook* #'tsdb::mem-score-configuration) ;;; ;;; the semantic interface (SEM-I), used in MRS comparison and generation ;;; (mt:read-semi (lkb-pathname (parent-directory "etc") "erg.smi")) ;;; ;;; the mapping from grammar-internal to SEM-I compliant variable properties ;;; #-:openproof (mt:read-vpm (lkb-pathname (parent-directory) "semi.vpm") :semi) #+:openproof (mt:read-vpm (lkb-pathname (parent-directory) "openproof/semi.vpm") :semi) ;;; ;;; another variable property mapping, used only when constructing the SEM-I ;;; (mt:read-vpm (lkb-pathname (parent-directory) "abstract.vpm") :abstract) ;;; ;;; finally, use the new transfer component: load any number of rule sets, each ;;; in a separate file, associated with its identifier. ;;; (lkb-load-lisp (this-directory) "mt.lsp" t nil) ;;; ;;; the following two rule sets could possibly be merged at some point, but ;;; for right now dan prefers keeping them separate. (3-may-05; oe) ;;; ;#-:openproof (mt:read-transfer-rules (list (lkb-pathname (parent-directory) "paraphraser.mtr") #+(or :educ :mal) (lkb-pathname (parent-directory) "educ/educ.mtr") ) "MWE Paraphraser" :before "mrs::normalize-mrs" :filter nil :task :paraphrase) ;#+:openproof ;(mt:read-transfer-rules ; (list ; (lkb-pathname (parent-directory) "openproof/openproof.mtr")) ; "Generation Input Fix-Up Rules for OpenProof" ; :before "mrs::normalize-mrs" :filter nil :task :paraphrase :edges 200) ;#-:openproof (mt:read-transfer-rules (list (lkb-pathname (parent-directory) "idioms.mtr")) "Idiom Tests" :filter nil :task :idiom) (mt:read-transfer-rules (list #-:openproof (lkb-pathname (parent-directory) "trigger.mtr") #+:openproof (lkb-pathname (parent-directory) "openproof/trig-op.mtr") ) "Generation Trigger Rules" :filter nil :task :trigger :recurse nil :edges 200 :subsume nil) #| (mt:read-transfer-rules (list (lkb-pathname (parent-directory) "generation.mtr")) "Generation Input Fix-Up Rules" :before "mrs::normalize-mrs" :filter nil :task :fixup :edges 200) |# #+:null (mt:read-transfer-rules (list (lkb-pathname (parent-directory) "cluster.mtr")) "Cluster Normalizer" :filter nil :task :paraphrase) #+:null (mt:read-transfer-rules (list (lkb-pathname (parent-directory) "semiout.mtr")) "SEMI example generator" :filter nil :task :paraphrase :recurse nil :subsume t) ;;; ;;; finally, this time really, compute a head table for non-unary rules. this ;;; is such a cheap operation that it seems best to let it run automatically ;;; each time the grammar is (re-)loaded. ;;; (with-open-file (stream (lkb-pathname (parent-directory) "erg.hds") :direction :output :if-exists :supersede) (let ((rules (loop for rule being each hash-value in *rules* collect rule))) (loop for rule in (sort rules #'string< :key #'rule-id) do (format stream "~(~a~) ~a ~a~%" (rule-id rule) (length (rule-rhs rule)) (rule-head rule))))) (setf *start-symbol* '(root_strict root_informal)) #+(or :educ :mal) (setf *start-symbol* '(root_decl root_question root_command root_robust_ques root_robust_s root_inffrag root_robust_frag root_lex root_informal)) #+:openproof (setf mrs::*icons-p* nil)