|
|
Using GFU-LAB1. InstallationIn order to install GFU-LAB, it suffices to copy the distributed files in a directory. A quick startIn order to get an idea of GFU-LAB capabilities, load SWI-Prolog, consult
2. A grammar in GFU-LABIn order to write a grammatical description of a language, two ASCII files should be created: one containing grammar rules, and other including lexical entries. The syntax file must have the extension In any kind of file, a line of text preceeded by the sign '%' is a comment, and will be ignored by the compiler. 2.1 The syntax fileThe syntax file must include, in the specified order:
In addition, it may contain a language declaration and an axiom declaration. The function declaration informs the compiler about those relations governed by any lexical predicate. The format of this declaration is as follows: FG = A. Where A is a sequence of relation labels, separated by blanks. Note the declaration must be ended by a dot. For instance: FG = subject object complement. Although not strictly neceessary, it is possible to declare the name of the language described in the file. The form of this declaration is: LANGUAGE = A. Where A is an atomic symbol, as in: LANGUAGE = English. This declaration is only worth when the command It is also possible to declare which is the axiom of the grammar (i.e. the maximal category that GFU-LAB tries to prove the utterance is parsing corresponds to). By default, the axiom is S (=Sentence). The axiom is declared: AXIOM = A. Where A is a symbol corresponding to a phrasal category defined in the grammar. For instance: AXIOM = SENT. 2.2 Lexicon FileThe lexicon file will include, in this order:
3. Pragmatics: how to get the best from GFU-LABJust like every computational tool, GFU-LAB may be used in a more or less efficient way. This section intends to give the reader some hints in order to take advantage of the virtues of the system, and to ellude its inadequacies. 3.1 Syntax errorsGFU-LAB does not report syntax errors in the files. It limits itself to say is a given rule has not been compiled, without pointing out where is exactly the problem. Generally speaking, most errors happen because of some negligences:
3.2 Ways to increase the efficiency of grammarsAs a rule of thumb to design efficient grammars, GFU-LAB user should write the rules so that they cooperate with the parser strategy. These are some tips:
The user interfaceThe user interface of GFU-LAB has many commands that aid to write and test the grammars: 4.1 Grammar writingl FILENAME It loads the specified data file (Unix paths are admitted). This may be a syntax file (extension [no] links If the LINKS choice is used, the system will create a table of links (v. section 8 of the user manual) when compiling PS rules. This operation can take excessive time, specially in the writing-and-test stage of development of grammars. If the NO LINKS choice is used, no table is created, and files load quickly. However, the parsing time could be much higher. Bt default, the system works in LINKS mode. 4.2 Grammar testing[no] det When the DET choice is taken, the parser will work deterministically: only the first parse will be shown. If the NO DET choice is used, the system will yield all the possible parses, according to the rules in the grammar. By default, the system opens in DET mode. [no] trace Allows to trace and untrace the parser operation. If TRACE is selected, the system will pause in every step. The user will then be able to inspect the composed DF (choice 'v'), to switch the trace off (choice 'n') or to keep on tracing (RETURN key). axiom = Category Permits to redefine the axiom with a new category. For instance, in order to parse only noun phrases, the user should writeaxiom = NP * Utterance parses the specified utterance. test Number If a test sentence file (extension see list Shows the last DF produced by the parser. The display is lineal. synt Pretty-prints the last F-structure produced by the parser. Very often, F-structures are quite complex and lengthy, so that they do not fit in the screen, it is possible to specify which attributes we are interested in, thus allowing the system to ignore the others. For instance, in order to display only the features 'pred' and 'tense' we will input:> synt: pred tense 4.3 Other commandss Filename Saves the grammatical database in the file specified. The file will contain PROLOG code. info Should this command been solicited, the system reports the state of certain internal records (LINK mode, determinism mode, etc). It also shows the language whose grammar is currently loaded, the number of PS rules, links and lexical entries available. For instance:GFU> info Language........... English Axiom ............. S Parsing ........... deterministic, optimized PS Rules .......... 26 LINKs ............. 82 Lexical entries ... 115 exit it exits from the system, and returns to the shell. It will finish the working session with GFU-LAB. Author: Juan C. Ruiz Anton (Universitat Jaume I, Castelló, Spain) |