next up previous contents
Next: Executing Grammars: Parsing Up: Running and Debugging ALE Previous: Evaluating Definite Clause Queries   Contents

Displaying Grammars

ALE provides a number of routines for displaying and debugging grammar specifications. After compile-time errors have been taken care of, the queries described in this section can display the result of compilation.

Lexical entries can be displayed using the following form of query:


  | ?- lex(kid).
  
  WORD: kid
  ENTRY: 
  cat
  QSTORE e_list
  SYNSEM basic
         SEM property
             BODY kid
                  ARG1 [0] individual
             IND [0] 
         SYN n
  
  ANOTHER?  y.

  no
As usual, if there are multiple entries, ALE makes a query as to whether more should be displayed. In this case, there was only one entry for kid in the categorial grammar in the appendix.

Another predicate, export_words( Stream, Delimiter), writes an alphabetised list of all of the words in the lexicon, separated by Delimiter, to Stream. In SICStus Prolog, for example, export_words(user_output,'$\backslash$n') will write the words to standard output (such as the screen), one to a line.

Empty lexical entries can be displayed using:


  | ?- empty.
  
  EMPTY CATEGORY: 
      cat
      QSTORE ne_list_quant
             HD some
                RESTR [0] proposition
                SCOPE proposition
                VAR [1] individual
             TL e_list
      SYNSEM forward
             ARG basic
                 SEM property
                     BODY [0] 
                     IND [1] 
                 SYN n
             RES basic
                 SEM [1] 
                 SYN np
  
  ANOTHER?  no.
Note that the number specification was removed to allow the empty category to be processed with respect to the categorial grammar type system. As with the other display predicates, empty provides the option of iterating through all of the possibilities for empty categories.

Grammar rules can be displayed by name, as in:


| ?- rule forward_application.

RULE: forward_application

MOTHER: 

  cat
  QSTORE [4] list_quant
  SYNSEM [0] synsem

DAUGHTERS/GOALS:

CAT  cat
     QSTORE [2] list_quant
     SYNSEM forward
            ARG [1] synsem
            RES [0] 

CAT  cat
     QSTORE [3] list_quant
     SYNSEM [1] 

GOAL  append([2],
             [3],
             [4])

ANOTHER?  n.
Rules are displayed as most general satisfiers of their mother, category and goal descriptions. It is important to note that this is for display purposes only. The rules are not converted to feature structures internally, but rather to predicates consisting of low-level compiled instructions. Displaying a rule will also flag any errors in finding most general satisfiers of the categories and rules in goals, and can thus be used for rule debugging. This can detect errors not found at compile-time, as there is no satisfiability checking of rules performed during compilation.

Macros can also be displayed by name, using:


  | ?- macro np(X).
  
  MACRO: 
      np([0] sem_obj)
  ABBREVIATES:
      basic
      SEM [0] 
      SYN np
  
  ANOTHER?  n.
First note that the macro name itself is displayed, with all descriptions in the macro name given replaced with their most general satisfiers. Following the macro name is the macro satisfied by the macro description with the variables instantiated as shown in the macro name display. Note that there is sharing between the description in the macro name and the SEM feature in the result. This shows where the parameter is added to the macro's description.

Finally, it is possible to display lexical rules, using the following query:


  | ?- lex_rule plural_n.

  LEX RULE: plural_n
  INPUT CATEGORY: 
      n
      NUM sing
      PERS pers
  OUTPUT CATEGORY: 
      n
      NUM plu
      PERS pers
  MORPHS: 
      [g,o,o,s,e] becomes [g,e,e,s,e]
      [k,e,y] becomes [k,e,y,s]
      A,[m,a,n] becomes A,[m,e,n]
      A,B becomes A,B,[e,s]
          when fricative(B)
      A,[e,y] becomes A,[i,e,s]
      A becomes A,[s]
  
  ANOTHER?  n.
Note that the morphological components of a rule is displayed in canonical form when it is displayed. Note that variables in morphological rules are displayed as upper case characters. When there is sharing of structure between the input and output of a lexical rule, it will be displayed as such. As with the other ALE grammar display predicates, if there are multiple solutions to the descriptions, these will be displayed in order. Also, if there is a condition on the categories in the form of an ALE definite clause goal, this condition will be displayed before the morphological clauses. As with grammar rules, lexical rules are compiled internally and not actually executed as feature structures. The feature structure notation is only for display. Also, as with grammar rules, displaying a lexical rule may uncover inconsistencies which are not found at compile time.


next up previous contents
Next: Executing Grammars: Parsing Up: Running and Debugging ALE Previous: Evaluating Definite Clause Queries   Contents
Detmar Meurers
2001-03-03