;;; -*- Mode: Lisp; Coding: utf-8 -*- ;;; HAG (Hausa Grammar) ;;; Author: Berthold Crysmann ;;; 2009 (set-coding-system utf-8) (lkb-load-lisp (parent-directory) "Version.lsp" t nil) (setf *grammar-directory* (parent-directory)) #+(and :logon :tsdb) (progn (lkb-load-lisp (great-grandparent-directory) "lingo/lkb/src/tsdb/lisp/pvm.lisp" t nil) (lkb-load-lisp (great-grandparent-directory) "lingo/lkb/src/tsdb/lisp/www.lisp" t nil) (lkb-load-lisp (great-grandparent-directory) "lingo/lkb/src/tsdb/lisp/process.lisp" t nil) (lkb-load-lisp (parent-directory) "www/setup.lsp" t nil) ) (lkb-load-lisp (this-directory) "globals.lsp" nil nil) #+:chart-mapping (lkb-load-lisp (this-directory) "lkb-fos-patch-25-jul-2022.lsp" nil nil) #+:chart-mapping (lkb-load-lisp (this-directory) "tm.lisp" nil nil) (lkb-load-lisp (this-directory) "user-fns.lsp" nil nil) (load-lkb-preferences (this-directory) "user-prefs.lsp") ;;; Bold fonts now appear to work, provided proper fonts are loaded ;;; Cannot confirm this as of May 13 2015. ;;; Seems to work once 100dpi fonts are uninstalled. Jun 2016 (except bold) ;(lkb-load-lisp (this-directory) "lkbpatches.lsp" t nil) (lkb-load-lisp (this-directory) "checkpaths.lsp" t nil) ;;; Token mapping ;;; ;;; Optionally, load a set of irregular morphological patterns ;;; (load-irregular-spellings (list ;; (lkb-pathname (parent-directory) "irregs.tab") ;; (lkb-pathname (parent-directory) "robust.tab") ) ) ;;; ;;; Now the core grammar, which will typically be spread out ;;; across multiple files. The Matrix provides matrix.tdl, ;;; defining most of the matrix types and head-types.tdl, which ;;; contains the intermediate types in the subhierarchy under head ;;; (as they would unnecessarily clutter matrix.tdl). You should ;;; rename my_language.tdl to something appropriate, and enter ;;; language-specific types there. In larger grammars, it is common ;;; to separate out e.g. lexical types from construction types ;;; into distinct files. All files containing types used in ;;; the grammar should be mentioned in the following command. ;;; ;;; (2004-06-08) transfer.tdl includes some types which support ;;; transfer rules. Still under development -- ignore for the ;;; time being. ;;; (read-tdl-type-files-aux (list (lkb-pathname (parent-directory) "matrix.tdl") (lkb-pathname (parent-directory) "head-types.tdl") (lkb-pathname (parent-directory) "fundamentals.tdl") (lkb-pathname (parent-directory) "supra.tdl") (lkb-pathname (parent-directory) "morph.tdl") (lkb-pathname (parent-directory) "pn.tdl") (lkb-pathname (parent-directory) "ruletypes.tdl") (lkb-pathname (parent-directory) "lextypes.tdl") (lkb-pathname (parent-directory) "mtr.tdl") (lkb-pathname (parent-directory) "tmt.tdl") )) (mt:read-transfer-rules (list (lkb-pathname (parent-directory) "trigger.mtr") (lkb-pathname (parent-directory) "reduplication.mtr") ) "generation trigger rules" :task :trigger :recurse nil ) (mt:read-transfer-rules (list (lkb-pathname (parent-directory) "generate.mtr") ) "pre-generation rules" :filter nil :task :fixup :edges 200) #| (mt:read-transfer-rules (list (lkb-pathname (parent-directory) "paraphrase.mtr") ) "Mini paraphraser" :filter nil :task :paraphrase :edges 200) |# ;;; ;;; Next, the lexicon itself, instantiating (lexical) types of the grammar ;;; (some grammars with larger lexica organize them into multiple files). ;;; (read-cached-lex-if-available (list ;(lkb-pathname (parent-directory) "kofar-V-lex.tdl") ;(lkb-pathname (parent-directory) "kofar-N-lex.tdl") (lkb-pathname (parent-directory) "lexicon.tdl") )) (read-cached-sublex-if-available "gle" (lkb-pathname (parent-directory) "gen-lex.tdl")) ;;; ;;; Finally, the grammar rules, lexical rules (given special treatment in the ;;; parser in that they can apply _prior_ to `inflectional' rules), and the ;;; `inflectional' rules themselves (rules with an associated orthographemic ;;; alternation of the surface string). ;;; (read-tdl-grammar-file-aux (lkb-pathname (parent-directory) "rules.tdl")) (read-tdl-lex-rule-file-aux (lkb-pathname (parent-directory) "lrules_min.tdl")) (read-tdl-lex-rule-file-aux (lkb-pathname (parent-directory) "lrules.tdl")) (read-morph-file-aux (lkb-pathname (parent-directory) "irules.tdl")) ;;; Load tone irules for LKB parsing (not used in generation) ;;; (read-morph-file-aux (lkb-pathname (this-directory) "tone-irules.tdl")) ;;; ;;; The `start symbol(s)' of the grammar. ;;; (read-tdl-psort-file-aux (lkb-pathname (parent-directory) "roots.tdl")) ;;; ;;; Optionally, a set of types providing labels for nodes in parse trees ;;; (read-tdl-parse-node-file-aux (lkb-pathname (parent-directory) "labels.tdl")) ;;; ;;; A few more LKB-specific settings, this time for MRS post-processing and ;;; generation; also, we always compute the generation index (while we have ;;; small lexica) in the hope that the generator will be used frequently. ;;; (lkb-load-lisp (this-directory) "mrsglobals.lisp" t nil) #+:chart-mapping (progn (loop for file in '( "tmr/char.tdl" "tmr/tone.tdl" "tmr/affix.tdl" "tmr/redup.tdl" ) do (read-token-mapping-file-aux (lkb-pathname (parent-directory) file))) (read-lexical-filtering-file-aux (lkb-pathname (parent-directory) "tmr/lfr.tdl")) ) ;#+:tsdb ;(lkb-load-lisp (parent-directory "www") "setup.lsp" t) ;;; ;;; Matrix-derived grammars often have stable enough semantic ;;; representations that the grammar can usefully be tested ;;; by generating from them. The function index-for-generator() ;;; must be called for generation to be enabled. In grammars with ;;; small lexica, this takes a trivial amount of time. If ;;; generation is not being used regularly, and the indexing ;;; is taking too long, comment out the following. index-for-generator() ;;; can also be run from the expanded LKB top menu, under ;;; Generate. ;;; (mt:read-vpm (lkb-pathname (parent-directory) "semi.vpm") :semi) ;(lkb-load-lisp (this-directory) "mt.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) ;;; (read-preprocessor (lkb-pathname (parent-directory) "preprocessor.fsr") ) ;;; Load a maxent model (mainly for the demo) #+(and :logon :tsdb) (tsdb::read-model (lkb-pathname (parent-directory) "hag.g.mem")) #+(and :logon :tsdb) (setf *unpacking-scoring-hook* #'tsdb::mem-score-configuration) #+:arboretum (and (defparameter *gen-packing-p* nil) (defparameter *gen-first-only-p* t)) #+:arboretum (and (functionp #'ag-score-task) (setf *gen-scoring-hook* #'ag-score-task)) ;;; ;;; The following overwrites the LKB's default for what ;;; appears in the parse input dialog box. Putting a ;;; short list of basic sentences from your language ;;; in that position may be helpful. ;;; (defparameter *show-incomplete-lex-rule-chains* nil) (if (eq (length *last-parses*) 1) (setf *last-parses* '( "Allah ya gafarta malam"))) (setq mrs::*normalize-predicates-p* nil) ;;; No semi (index-for-generator) ;;; Make sure we have an environment that can display hooked letters. (lkb::lui-shutdown)