;;; Common user-fns file for all ESSLLI grammars (defun establish-linear-precedence (rule-fs) ;;; A function which will order the features of a rule ;;; to give (mother daughter1 ... daughtern) ;;; ;;; Modification - this must always give a feature ;;; position for the mother - it can be NIL if ;;; necessary (let* ((mother NIL) (daughter1 (get-value-at-end-of rule-fs '(ARGS FIRST))) (daughter2 (get-value-at-end-of rule-fs '(ARGS REST FIRST))) (daughter3 (get-value-at-end-of rule-fs '(ARGS REST REST FIRST)))) (declare (ignore mother)) (unless daughter1 (cerror "Ignore it" "Rule without daughter")) (append (list nil '(ARGS FIRST)) (if daughter2 (list '(ARGS REST FIRST))) (if daughter3 (if daughter2 (list '(ARGS REST REST FIRST))))))) (defun spelling-change-rule-p (rule) ;;; a function which is used to prevent the parser ;;; trying to apply a rule which affects spelling and ;;; which should therefore only be applied by the morphology ;;; system. ;;; Old test was for something which was a subtype of ;;; *morph-rule-type* - this tests for the type lrule-infl (let ((rule-type (type-of-fs (tdfs-indef (rule-full-fs rule))))) (or (eql rule-type 'lrule-infl) (subtype-p rule-type 'lrule-infl)))) (defun redundancy-rule-p (rule) ;;; a function which is used to prevent the parser ;;; trying to apply a rule which is only used ;;; as a redundancy rule (declare (ignore rule)) nil) ;;; return true for types that shouldn't be displayed in type hierarchy ;;; window. None of their descendents (if any) will be displayed either (defun hide-in-type-hierarchy-p (type-name) (and (symbolp type-name) (search "GLBTYPE" (symbol-name type-name)))) (defun make-orth-tdfs (orth) (let ((unifs nil) (tmp-orth-path *orth-path*)) (loop for orth-value in (split-into-words orth) do (let ((opath (create-path-from-feature-list (append tmp-orth-path *list-head*)))) (push (make-unification :lhs opath :rhs (make-u-value :type orth-value)) unifs) (setq tmp-orth-path (append tmp-orth-path *list-tail*)))) (push (make-unification :lhs (create-path-from-feature-list (append (butlast *orth-path*) '(last))) :rhs (create-path-from-feature-list tmp-orth-path)) unifs) (let ((indef (process-unifications unifs))) (when indef (setf indef (create-wffs indef)) (make-tdfs :indef indef)))))