Previous Up Next

Chapter 4  The Commands of ``malaga'' and ``mallex''

Since the user interfaces of malaga and mallex are very similar and since they have a bunch of commands in common, we will describe them in a common chapter. Commands that can be used in malaga or in mallex only, are marked by the name of the program in which they can be used.

4.1  The Command ``break''

If you want to stop the rules at a specific point, for example to take a look at the variables, you can use the command break to set breakpoints. A breakpoint is a point in the rule source text where rule execution is interrupted, so you can enter commands in debug mode. Breakpoints are only active in debug mode, this means you have started rule execution by a debug command or you have continued rule execution by one of the commands step, next, walk, or go.

Behind the command name, break, you can give one of the following arguments:
a line number.
A breakpoint is set at this line in the current source file. If there is no statement starting at this line, the breakpoint will be set at the nearest line where a statement starts. You can, for example, set a breakpoint at line 245 in the current source file by entering the command

break 245

a file name and a line number.
A breakpoint is set at this line in this file. If there is no statement starting at this line, the breakpoint will be set at the nearest line where a statement starts. An example:

break english.syn 59

a rule name.
A breakpoint is set at the first statement in this rule. An example:

break final_rule
If the rule name or the file name is ambiguous, you can insert an abbreviation for the rule system you refer to. Put it in front of the rule name or the file name. The following abbreviations are used:
all
for allomorph rules,
mor
for morphology rules,
syn
for syntax rules,
If you omit any argument, the breakpoint is set on the current line in the current file (this is helpful in debug mode).

Every breakpoint gets a unique number once it has been set, so you can delete it later, when you do not need it any longer.

You can list the breakpoints using the command list and delete them using delete.

4.2  The Command ``clear-cache'' (malaga)

If you have changed your settings so that the wordform cache is no longer valid, you can clear the cache using clear-cache.

4.3  The Command ``debug-entry'' (mallex)

Use debug-entry to find errors in your allomorph rules. This command works like ga, but the allomorph generation will be stopped before the first statement of the first rule is executed:
mallex> debug-entry [surface: "john", class: name]
at rule "irregular_verb"
debug> 
The prompt ``debug>'' that appears instead of ``mallex>'' indicates that mallex is currently executing the allomorph rules but has been interrupted. Since this ability has been developed to support the debugging of Malaga rules, this mode is called debug mode.

When mallex comes to the start of a new rule in debug mode (as in the example above), the name of this rule is printed. When in debug mode, you can always get the name of the current rule using the command rule.

If you're running mallex from Emacs, another Emacs window will display the source file. An arrow is used to show to the statement that will be executed next.
  ...
allo_rule irregular_verb ($entry):

=>? $entry.class = verb;
  ...
In debug mode, you can, for example, get the variables that are currently defined (using variable or print), and you can execute statements (using step, next, walk, go, or run). If you want to quit the debug mode, just enter run. The remaining statements for generation will then be executed without interruption.

4.4  The Command ``debug-file'' (mallex)

Use the command debug-file to make the allomorph rules work on a lexicon file in debug mode. Assume you have written a lexicon file ``mini.lex'':
[surface: "m{a}n", class: noun];
[surface: "table", class: noun];
[surface: "wise", class: adjective];
To let the rules process this lexicon in debug mode, enter:

debug-file mini.lex

4.5  The Command ``debug-line'' (mallex)

Use the command debug-line to make the allomorph rules generate allomorphs for a single lexicon entry in debug mode. Assume you want to test the second line in the lexicon file ``mini.lex'':
[surface: "m{a}n", class: noun];
[surface: "table", class: noun];
[surface: "wise", class: adjective];
Enter the following line:

debug-line mini.lex 2

Then mallex stops in debug mode at the entry of the first allomorph rule that is being executed for the lexicon entry ``[surface: "table", class:noun];''.

If there is no lexicon entry at this line, the subsequent lexicon entry will be taken.

4.6  The Command ``debug-mor'' (malaga)

Use the command debug-mor to find errors in your morphology combination rules. This command analyses the rest of the command line morphologically and executes the morphology combination rules in debug mode. Debug mode is explained for the command debug.

4.7  The Command ``debug-node'' (malaga)

Use the command debug-node to execute the successor rules of a specific LAG state in debug mode. Previously, you must have already analysed a word or a sentence, respectively. Make malaga display the analysis tree by entering tree, move the mouse pointer to the state node you want to debug, and press the left mouse button. A window opens in which this state's category is shown. The window's title line contains the number of the state node. Use this number as argument for debug-node. The last analysis input will be analysed again, and analysis stops when reaching the first successor rule of the specified state and malaga switches to debug mode.

4.8  The Command ``debug-syn'' (malaga)

Use the command debug-syn to find errors in your syntax combination rules. This command analyses the rest of the command line syntactically and executes the syntax combination rules in debug mode. Debug mode is explained for the command debug.

4.9  The Command ``delete''

If you want to delete a breakpoint, use the command delete with the number of the breakpoints as argument.

Enter ``delete all'' to delete all breakpoints.

4.10  The Command ``ga'' (mallex)

Use the command ga (short for ``generate allomorphs'') to generate allomorphs. This is useful for testing allomorph generation from within mallex. When you enter the command, give a lexicon entry as argument. All allomorphs that are generated from this entry by the allomorph rules, are printed on screen. For example:
mallex> ga [surface: "john", class: name]
surf: "john", cat: [class: name, base_form: "abraham"]
If the rules create multiple allomorphs from an entry, they are displayed one after another.

4.11  The Command ``ga-file'' (mallex)

Use the command ga-file to make the allomorph rules generate allomorphs for a lexicon file. Assume you have written a lexicon file ``mini.lex'':
[surface: "m{a}n", class: noun];
[surface: "table", class: noun];
[surface: "wise", class: adjective];
To generate the allomorphs for this lexicon, enter:

ga-file mini.lex

This will produce a readable allomorph file whose name ends in ``.cat'' (for categories); for ``mini.lex'' its name will be ``mini.lex.cat'':
surf: "man", cat: [class: noun, syn: singular]
surf: "men", cat: [class: noun, syn: plural]
surf: "table", cat: [class: noun]
surf: "wise", cat: [class: adjective, restr: complete]
surf: "wis", cat: [class: adjective, restr: inflect]

4.12  The Command ``ga-line'' (mallex)

Use the command ga-line to make the allomorph rules generate allomorphs for a single lexicon entry. Assume you want to test the second line in the lexicon file ``mini.lex'':
[surface: "m{a}n", class: noun];
[surface: "table", class: noun];
[surface: "wise", class: adjective];
Enter the following line:

ga-line mini.lex 2

Then mallex generates allomorphs for the lexicon entry ``[surface: "table", class:noun];''.

If there is no lexicon entry at this line, the subsequent lexicon entry will be taken.

4.13  The Command ``get''

This command is used to query settings of malaga or mallex. Enter it together with the name of the option whose setting you want to know. The possible options are described in the next chapter. If you just enter ``get'', all settings will be shown.

4.14  The Command ``go''

This command can only be executed in debug mode. The rule execution will be resumed and continued until a breakpoint is met or the rules have been executed completely.

4.15  The Command ``help''

Use this command to get a list of the commands you can use. If you give the name of a command or an option as argument, a short explanation of this item will be printed. If a name represents a command as well as an option, prepend ``command'' or ``option'' to it.

4.16  The Command ``info'' (malaga)

This command gives you information about the morphology or syntax rules you are using.

4.17  The Command ``list''

If you enter the command list, all breakpoints are listed. For each breakpoint, its number, the name of the source file and the source line is shown.

4.18  The Command ``ma'' (malaga)

The command ma (for morphological analysis) starts a word form analysis. Give the word form that you want to be analysed as argument:
malaga> ma house
Malaga will show the results automatically, and it will also show the analysis tree automatically if you specified it using the tree option. You can look at the results using result or at the entire analysis tree using tree.

If you do not enter a word form behind the command ma, malaga re-analyses the last input.

4.19  The Command ``ma-file'' (malaga)

The command ma-file can be used to analyse files that contain word lists. A word list consists of a number of word forms, each word form on a line on its own. There may be empty lines in a word list. The following example is a word list called ``word-list'':
table
men's
blue
handicap
To analyse this word list, enter:

ma-file word-list result

This will produce a file ``result'' that contains the analysis results. If the second argument is missing, the result will be written to a file whose name ends in ``.cat'' (for categories); for ``word-list'', its name will be ``word-list.cat'':
1: "table": [class: noun, ...]
2: "men's": [class: noun, ...]
3: "blue": [class: noun, ...]
3: "blue": [class: adjective, ...]
3: "blue": [class: name, ...]
4: "handicap: unknown
The number at the line start represents the line number of the analysed original word form. The output format can be changed by using the commands output-format and unknown-format.

If a runtime error occurs during the analysis of a word, the error message will be inserted into the result file, and the next word will be processed.

After the analysis, some statistics will be printed: The number of analysed and recognised word forms, the average number of results per word form, and the average number of word forms that have been analysed per second (if the analysis took long enough).

4.20  The Command ``mg'' (malaga)

Use the command mg to generate all word forms that consist of a specified set of allomorphs. For example, the command

mg 3 un able believe

generates all word forms that consist of up to three allomorphs, where only the specified allomorphs (``un'', ``able'', and ``believe'') are used. The word forms are numbered from 1 onward, but different analyses of the same word form get the same index. The output will look like this:
1: "able"
2: "believe"
3: "unable"
4: "unbelieveable"
Please note that generation does not know of filters, pruning rules and default rules.

4.21  The Command ``next''

This command can only be executed in debug mode. The rule execution will be resumed and continues until a different source line is met or until the rules have been executed completely. It is like step, but subrules will be executed without interruption. If you specify a number as argument, the command will be repeated as often as specified.

4.22  The Command ``output''

This command prints the results of the last analysis or allomorph generation as ordinary text. The output format can be changed by using the commands allo-format (for mallex), output-format, and unknown-format (for malaga).

4.23  The Command ``print''

You can only use the command print in debug mode or if the previous analysis has stopped with an error in the combination rules. Using this command, you get the values of all Malaga variables currently defined. The variables will be printed in the order of their definitions:
malaga> sa-debug You are beautiful.
entering rule "Noun", start: "", next: "You"
debug> print
$sentence = [class: main_clause, parts: <>]
$word = [class: pronoun, result: S2]
You can specify any variable names (including the ``$'') as arguments to this command; you can even specify a path behind each of the variable names. In this case, only the values of the specified variables or paths are printed:
debug> print $word
$word = [class: pronoun, result: S2]
debug> print $word.class
$word.class = pronoun
If the variable values are very complex, the output of print can be confusing. Please use the command variables in this case.

4.24  The Command ``quit''

Use this command to leave malaga or mallex.

4.25  The Command ``result''

If you have previously analysed a word form or a sentence using ma or sa (in malaga), or you have generated allomorphs using ga or ga-line (in mallex), you can display the results with ``result''. The analysis results will be displayed in a window on their own which is called ``Results'' for malaga and ``Allomorph'' for mallex. They are numbered from 1 onward.

If you are executing the command result for the first time, or if you have closed a Results/Allomorph window that you'd opened before, a window will open, displaying the values of all results/allomorphs of the last analysis/generation.

If there is a Results/Allomorph window currently opened, the new results/allomorphs will be displayed in this window.

The Results/Allomorph window has a menu with some commands:
Window:
Here, two items can be selected:
Export Postscript...:
Choose this item to convert the display content to Postscript and save it as a file.
Close:
Choose this item to close the Results/Allomorph window.
Font size:
Choose one of the menu's subitems to change the font size.

4.26  The Command ``rule''

This command can only be used in debugger mode or after rule execution has been stopped by an error. It prints the name of the rule that has been executed; additionally, the Start and Next surface are printed in malaga. For example:
debug> rule
at rule "flexion", start: "hous", next: "es"

4.27  The Command ``run''

This command can only be used in debug mode. The rule execution will be resumed, and the rules will be executed completely without any interruption.

If you have invoked the debug mode by the command debug-node, rule execution will be stopped again when another Next item will be analysed.

4.28  The Command ``sa'' (malaga)

If you have started malaga with a syntax file in your command line or in the project file, you can start syntactic analyses using the command sa (short for syntactic analysis). Put the sentence you want to be analysed as argument behind the command name:
malaga> sa The man is in town.
Malaga will show the results automatically, and it will also show the analysis tree automatically if you specified it using the tree option. You can look at the results using result or at the entire analysis tree using tree.

If you do not enter a sentence behind the command sa, malaga re-analyses the last input.

4.29  The Command ``sa-file'' (malaga)

Using the command sa-file, you can analyse files that contain sentence lists. In a sentence list, each sentence stands in a line on its own; empty lines are permitted. Here is an example, a sentence list named ``sentence-list'':
He sleeps.
He slept.
He has slept.
He had slept.
To analyse this sentence list, enter:

sa-file sentence-list result

This will produce a file ``result'' that contains the analysis results. If the second argument is missing, the result will be written to a file whose name ends in ``.cat'' (for categories); for ``sentence-list'', its name will be ``sentence-list.cat''.
1: "He sleeps.": [functor: [syn: <S3>, sem: <"sleep">], 
                  arguments: <[syn: S3, sem: "definite pronoun"]>]
2: "He slept.": [functor: [syn: <S3>, sem: <"sleep">], 
                 arguments: <[syn: S3, sem: "definite pronoun"]>]
3: "He has slept.": [functor: [syn: <S3>, sem: <"have", "sleep">], 
                     arguments: <[syn: S3, sem: "definite pronoun"]>]
4: "He had slept.": [functor: [syn: <S3>, sem: <"have", "sleep">], 
                     arguments: <[syn: S3, sem: "definite pronoun"]>]
The number at the line start represents the line number of the analysed original sentence. The output format can be changed by using the commands output-format and unknown-format.

If a runtime error occurs during the analysis of a sentence, the error message will be inserted into the result file, and the next sentence will be processed.

After the analysis, some statistics will be printed: The number of analysed and recognised sentences, the average number of results per sentence, and the average number of sentences that have been analysed per second (if the analysis took long enough).

4.30  The Command ``set''

This command is used to change the settings of malaga or mallex. The command line ``set option argument'' changes option to argument.

If you want to get the current state of an option, use the command get. Options can also be set in the project file. The possible options are described in the next chapter.

4.31  The Command ``sg'' (malaga)

Use sg to generate sentences that are composed of a specified set of word forms. For example, if you enter

sg 3 . ? he she sleeps

all sentences that consist of up to three word forms, where only the specified word forms (``.'', ``?'', ``he'', ``she'', and ``sleeps'') are used. The sentences are numbered from 1 onward, but different analyses of the same sentence get the same index. The output looks like this:
malaga> sg 3 . ? he she sleeps
1: "he sleeps ."
2: "he sleeps ?"
3: "she sleeps ."
4: "she sleeps ?"
Please note that generation does not know of filters, pruning rules and default rules.

4.32  The Command ``step''

This command can only be executed in debug mode. The rule execution will be resumed and continues until a different source line is met or until the rules have been executed completely. If you specify a number as argument, the command will be repeated as often as specified.

4.33  The Command ``trace''

If you are executing your rules in debug mode or the rules were interrupted by an error, this command shows were rule execution currently stopped. If it stopped in a subrule, all calling rules are also shown.
debug> trace
line 23 in file "dmm-deutsch.syn", rule "fill_valencies"
line 391 in file "dmm-deutsch.syn", rule "main_clause_end"
This means, rule execution stopped in line 23 of ``dmm-deutsch.syn'', in rule ``fill_valencies''. This subrule was called from line 391 in ``dmm-deutsch.syn'', in rule ``main_clause_end''.

4.34  The Command ``transmit'' (malaga)

4.35  The Command ``tree'' (malaga)

If you've started a grammatical analysis using one of the commands ma or sa (or their debug variants), you can make malaga display the result by entering

tree

If the analysis has not yet finished (in debug mode or in case of an error), an intermediate result will be shown.

If you're executing the command tree for the first time, or if you've closed the Tree window before, a new tree window will open in which the current analysis tree will be displayed.

If there is already a Tree window open, the new analysis tree will be displayed in this window.

In the upper left corner of the Tree window, you will see the sentence or the word form that has been analysed. Below, the analysis tree is displayed. An analysis path always follows the edges from the left to the right.

A circle node stands for a LAG state, a two-circle node stands for an end state.

Above each edge, the Next surface that has been read in by the corresponding rule application is displayed. On the bottom of an edge, you'll see the name of the applied rule.

You can click on a node using the left mouse button. Then another window will open, namely the Path window. The Path window displays the surface, the category and the successor rules of the state you've clicked on. The node will be highlighted by a fatter border. If you've already clicked on a node, you can click on one of its successor nodes using the right mouse button. Then all rule applications, from the state clicked on previously up to the state clicked on this time, will be displayed in the Path windows. The corresponding path will be highlighted in the Tree window.

If you're clicking on a Next surface using the left mouse button, the surface and its category will be displayed in the Path window.

You can also click on rule names using the left mouse button. Then the corresponding rule application will be displayed in the Path window, i.e. the Start, Next and Result surface, the Start, Next and Result category, and the successor rules.

There are some commands that can be started from the Tree menu bar:
Window:
Here you can select from two menu items:
Export Postscript...:
Convert the displayed analysis tree to a Postscript file.
Close:
Close the Tree window.
Font size:
Select an item in this menu to adjust the font size.
View:
Specify which nodes of the analysis tree are actually displayed.
Result paths only:
Only the nodes that are part of a complete analysis are displayed.
All but dead ends:
All analysis states are displayed.
All nodes:
All analysis states are displayed, and also rectangular nodes for rule applications that did not succeed (dead ends).
Result:
Select an end state to display in the Path window.
First result:
Display the first end state.
Previous result:
If there is an end state displayed in the Path window, jump to the previous one.
Next result:
If there is an end state displayed in the Path window, jump to the next one.
Last result:
Display the last end state.
The Path windows has got an own menu bar which contains the menus Window, Font size and Result with the same menu items as the corresponding menus in the Tree window.

4.36  The Command ``variables''

Use this command if you want to examine the values of the currently defined variables. They will be displayed in window on their own. You do not need to give any arguments, but you can only execute this command if malaga is in debug mode or if the previous analysis has been stopped by an error in the rules.

If you are executing the command variables for the first time, or if you have closed a Variables window that you'd opened before, a window will open, displaying the values of all variables currently defined.

If there is a Variables window currently opened, the new variable contents will be displayed in this window.

The Variables window has a menu with some commands:
Window:
Here, two items can be selected:
Export Postscript...:
Choose this item to convert the variable display to Postscript and save it as a file.
Close:
Choose this item to close the Variables window.
Font size:
Choose one of the menu's subitems to change the font size.
Variables:
Show selected variables:
Choose one of the menu's subitems (variable names) to hide (or show) the corresponding variable.
Show all variables:
Choose this item to display all variables that are currently defined.
Show no variables:
Choose this item to suppress the display of all defined variables.

4.37  The Command ``walk''

This command works in debug mode only. The rule execution will be continued and stopped again as soon as a new rule is executed, a breakpoint is met or there are no more rules to execute.


Previous Up Next