;;; File: ellipsis.lisp
;;; Last saved in emacs: Time-stamp: <97/01/22 22:48:56 jlitchfi>

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; This patch allows ellipsis of plural and singular nouns              ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(SYSTEM
 :NAME                   substitution-ellipsis
 :INPUTS                 substitution-ellipsis
 :OUTPUTS                ((0.5 substitution)
			  (0.5 ellipsis))
 :CHOOSER                substitution-ellipsis-chooser
 :REGION                 ELLIPSIS
 :METAFUNCTION           IDEATIONAL
 )

(GATE
 :NAME                   MASS-HEAD-ELLIPSIS
 :INPUTS                 (or (AND SUBSTITUTION NONSINGULAR NONPLURAL)
			     ellipsis)
 :OUTPUTS                ((1.0 HEAD-ELLIPSIS
                               (LEXIFY THING ELLIPSISZERO)))
 :REGION                 ELLIPSIS
 :METAFUNCTION           TEXTUAL
 )

(GATE
 :NAME                   PLURAL-HEAD-SUBSTITUTION
 :INPUTS                 (AND PLURAL SUBSTITUTION)
 :OUTPUTS                ((1.0 SUBSTITUTE-ONES
                               (LEXIFY THING ONESSUBSTITUTE)))
 :CHOOSER                PLURAL-HEAD-SUBSTITUTION-CHOOSER
 :REGION                 ELLIPSIS
 :METAFUNCTION           TEXTUAL
 )

(GATE
 :NAME                   SINGULAR-HEAD-SUBSTITUTION
 :INPUTS                 (AND SINGULAR SUBSTITUTION)
 :OUTPUTS                ((1.0 SUBSTITUTE-ONE (LEXIFY THING ONESUBSTITUTE)
                               (INFLECTIFY THING SINGULAR-FORM)))
 :CHOOSER                SINGULAR-HEAD-SUBSTITUTION-CHOOSER
 :REGION                 ELLIPSIS
 :METAFUNCTION           TEXTUAL
 )

(CHOOSER
 :NAME                   substitution-ellipsis-chooser
 :DEFINITION             ((ASK (ellipsis-q THING)
			       (substitution (CHOOSE substitution))
			       (ellipsis (choose ellipsis))))
 :DATE                   "17/05/96"
 )

(ASKOPERATOR
 :NAME                   ellipsis-q
 :DOMAIN                 TP
 :PARAMETERS             (ITEM)
 :ENGLISH                ( "Is "
			   ITEM
			   " to be ellided or replaced?")
 :OPERATORCODE           trivialdefaultcode
 :PARAMETERASSOCIATIONTYPES      (CONCEPT)
 :ANSWERSET              (substitution ellipsis)
 :TRIVIALDEFAULT         substitution
 )

(defspl-macro :substitution
              ((singular-substitution
                 :minimal-attention-q minimal
                 :semantic-coverage-q covered
		 :ellipsis-q substitution
                 :number singular)
	       (singular-ellipsis
                 :minimal-attention-q minimal
                 :semantic-coverage-q covered
		 :ellipsis-q ellipsis
                 :number singular)
               (plural-substitution
                 :minimal-attention-q minimal
                 :semantic-coverage-q covered
		 :ellipsis-q substitution
                 :number plural)
	       (plural-ellipsis
                 :minimal-attention-q minimal
                 :semantic-coverage-q covered
		 :ellipsis-q ellipsis
                 :number plural)
               (ellipsis
                 :minimal-attention-q minimal
                 :semantic-coverage-q covered
                 :number mass)))