;;; Hey, emacs(1), this is -*- Mode: Common-Lisp; Package: LKB; -*- got it?

;;;
;;; First, load a number of LKB-specific settings; typically no need to look
;;; too closely here, but note that several settings files exist in two forms,
;;; one in the global Transfer MatriX directory, another per language pair.
;;;
(lkb-load-lisp (parent-directory) "Version.lsp" t)
(lkb-load-lisp (grandparent-directory) "globals.lsp")
(lkb-load-lisp (this-directory) "globals.lsp")
(lkb-load-lisp (this-directory) "user-fns.lsp")

;;;
;;; next load the common transfer type hierarchy (the Transfer MatriX) ...
;;;
(read-tdl-type-files-aux
  (list 
   (lkb-pathname (grandparent-directory) "mrs.tdl")
   (lkb-pathname (grandparent-directory) "mtr.tdl")
   (lkb-pathname (grandparent-directory) "predicates.tdl")
   (lkb-pathname (grandparent-directory) "predicates.erg.tdl")
   ;;
   ;; ... plus additional MRS and MTR type definitions for this language pair
   ;;
   (lkb-pathname (parent-directory) "mrs.tdl")
   (lkb-pathname (parent-directory) "mtr.tdl")
   (lkb-pathname (parent-directory) "predicates.tdl")))

;;;
;;; a few more LKB-specific settings, this time for MRS post-processing,
;;; generation, and transfer.
;;;
(lkb-load-lisp (grandparent-directory) "mrsglobals.lsp" t)
(lkb-load-lisp (this-directory) "mrsglobals.lsp" t)
(lkb-load-lisp (this-directory) "mt.lsp")

;;;
;;; read the `in' and `out' variable property mappings (VPMs), adjusting index
;;; properties in input and output MRSs, respectively.
;;;
(mt:read-vpm (lkb-pathname (parent-directory) "in.vpm") :in)
(mt:read-vpm (lkb-pathname (parent-directory) "out.vpm") :out)

;;;
;;; also read the target language SEM-I, so as to filter transfer ouputs that
;;; are doomed to fail downstream.
;;;
(mt:read-semi (logon-file "lingo/erg" "erg.smi"))

;;;
;;; transfer operates in three phases: (i) NorGram-specific accomodation, (ii)
;;; core transfer, and (iii) ERG-specific accomodation.
;;;
(mt:read-transfer-rules 
 (list
  (lkb-pathname (parent-directory) "norgram.mtr"))
 "SL accomodation phase"
 :filter nil)

(mt:read-transfer-rules 
 (list
  (lkb-pathname (parent-directory) "mwe.mtr")
  (lkb-pathname (parent-directory) "nn.mtr")
  (lkb-pathname (parent-directory) "andre.nn.mtr")
  #-:debug
  (lkb-pathname (parent-directory) "kf.nn.mtr")
  (lkb-pathname (parent-directory) "names.mtr")
  (lkb-pathname (parent-directory) "abstract.mtr")
  (lkb-pathname (parent-directory) "abcd.mtr")
  (lkb-pathname (parent-directory) "efgh.mtr")
  (lkb-pathname (parent-directory) "ijklmn.mtr")
  (lkb-pathname (parent-directory) "opqrst.mtr")
  (lkb-pathname (parent-directory) "uvwxyz.mtr")
  (lkb-pathname (parent-directory) "æøå.mtr")
  (lkb-pathname (parent-directory) "prepositions.mtr")
  (lkb-pathname (parent-directory) "focal.mtr")
  (lkb-pathname (parent-directory) "collocations.mtr")
  #-:debug
  (lkb-pathname (parent-directory) "petter.mtr")
  (lkb-pathname (parent-directory) "andre.n.mtr")
  (lkb-pathname (parent-directory) "unknown.n.mtr")
  (lkb-pathname (parent-directory) "lars.nn.mtr")
  #-:debug
  (lkb-pathname (parent-directory) "kf.a.mtr")
  #-:debug
  (lkb-pathname (parent-directory) "kf.n.mtr")
  ;;
  ;; at this point, for further fine-tuning, infuse information from the TL
  ;; SEM-I, thus marking predicates that are strictly countable or strictly
  ;; non-countable.  then invoke the global `snugging' rules (which provide
  ;; reasonably generic mechanisms for processes like splitting up or joining
  ;; variables), followed by further snugging rules, specific to this language
  ;; pair.
  ;;
  (lkb-pathname (grandparent-directory) "semi.erg.mtr")
  (lkb-pathname (grandparent-directory) "snug.mtr")
  (lkb-pathname (parent-directory) "snug.mtr"))
 "core transfer phase"
 :filter t)

(mt:read-transfer-rules 
 (list
  (lkb-pathname (grandparent-directory) "erg.mtr")
  (lkb-pathname (parent-directory) "erg.mtr")
  (lkb-pathname (grandparent-directory) "finale.mtr"))
 "TL accomodation phase"
 :out :out :post :erg :filter nil)