This chapter lists the important predicates used in Hdrug.
Two of the three arguments must be Prolog atoms. The print-name of the third atom is the concatenation of the print names of the first two atoms. Examples:
| ?- concat(foo,bar,X).
X = foobar ?
| ?- concat(X,bar,foobar).
X = foo ?
| ?- concat(foo,X,foobar).
X = bar ?
concetenates the print names of all the atoms in ListOfAtoms together; possibly using the optional third argument as a seperator. Example:
L = 'foo+bar+foo+bar' ?
Is true when Lower, Upper, and Number are integers, and Lower =< Number =< Upper. If Lower and Upper are given, Number can be tested or enumerated. If either Lower or Upper is absent, there is not enough information to find it, hence failure. Numbers are generated in ascending order. If you want descending order, use between/4. The optional fourth argument is the atom + to indicate ascending order, or
to indicate descending order. Example:
?- findall(X,between(1,10,X), Xs).
Xs = [1,2,3,4,5,6,7,8,9,10] ?
?- findall(X,between(1,10,X,-), Xs).
Xs = [10,9,8,7,6,5,4,3,2,1] ?
Atom is read-in as if it where a Prolog term. Example:
| ?- atom_term('f(A,B,A)',L).
L = f(_A,_B,_A) ?
The Prolog term Term is turned into an atom, as if quotes were placed around it. Example:
| ?- term_atom(f(f(f(f))),L).
L = 'f(f(f(f)))' ?
As is clear from the following example, the result is arbitrary in case Term contains variables:
L = 'f(_83,_105,_83)' ?
A new atom Atom is generated. If Prefix is specified, then the print name of Atom will start with Prefix.
Writes to standard output the number of times :Spec succeeds. Example:
| ?- report_count_edges_pred(library_directory/1).
Writes to standard output the number of times :Goal succeeds. Example:
| ?- report_count_edges(lists:member(_,[a,b,c,d])).
lists:member(_95,[a,b,c,d]) : 4
Int is an integer indicating the number of times Goal succeeds.
If Int is smaller or equal to the current value of flag(debug), then Goal is called. Used to wrap around debugging and continuation calls. Larger values for Int indicate that the goal is executed less often.
If Int is smaller or equal to the current value of flag(debug), then the goal format(user_error,FormatStr,FormatArgs) is executed.
Hdrug manages a number of global variables, called flags. This predicate sets flag Flag to Val only if Flag is currently undefined.
Hdrug manages a number of global variables, called flags. This predicate sets flag Flag to Val.
Hdrug manages a number of global variables, called flags. This predicate sets flag Flag to NewVal, unifying the old value with OldVal. If only two arguments are given, then the flag is unchanged. If only a single argument is given, then Flag is allowed to be uninstantiated. It will be bound to all existing flags upon backtracking.
Reverses the effect of prettyvars; i.e. all '$VAR'/1 terms are replaced by corresponding variables.
Similar to the built-in numbervars, except that all variables which only occur once in Term are replaced by '$VAR'('_').
handles the syntax of conjuncts. This code wraps call(_) around variables, flattens conjunctions to (A;(B;(C;(D;E)))) form, and drops 'true' conjuncts.
handles the syntax of disjuncts. This code wraps call(_) around variables, flattens disjunctions to (A,(B,(C,(D,E)))) form, and drops 'false' disjuncts.
Tries to call Goal, but only if the predicate is known to exist. If the first Goal fails, or if it does not exist, then the second goal is called. If no second goal is given then the predicate succeeds.
hook/1 calls its argument, but only if it is defined; if it is not defined the precate fails. Useful to call optional hook predicates for which no undefined predicate warnings should be produced.
calls Goal only if graphical user interface is currently running; if not the predicate calls AltGoal, if it is specified, or succeeds
Starts the command interpreter.
Attempts to start the graphical user interface, but will not start it if flag(tcltk) is switched off
a Tcl array named ArrayName is constructed where the values in List are to be the values in the array, i.e. ArrayName(1), ArrayName(2), etc.; the special value ArrayName(max) is set to the last index of the array (counting starts at 0). The flag update_array_max can be used to pass to Tcl only the first N items. If that value is 0 then all items are passed on (default=1000).
Term is displayed as a feature-structure on the canvas widget of the graphical user interface
Each Term in List is displayed as a feature-structure on the canvas widget of the graphical user interface
Term is displayed on the canvas of the graphical user interface
Abbrevation for the tcltk library predicate tcl_eval/3. The current TclTk interpreter, accessible through the tcl_interp flag, is added as the first argument.
Expr is a string as accepted as the second argument of format/3; the optional Subs is equivalent to the third argument of format/3. After evaluating the meta-charcters in Expr, the string is sent as a tcl command using the current tcl interpreter (flag tcl_interp). The return string is turned into an atom and available in the optional third argument.
Displays the object numbered No using the Style and Output. These latter two arguments are of the type accepted by the first and second argument of the generic show/3 predicate.
Generic interface to the Hdrug visualization tools. Style is one of:
words (only defined for object/2 things; displays the phonological representation of an object, i.e. Phon in object(Ident,o(Cat,Phon,Sem))
sem (only defined for object/2 things; displays the semantic representation of an object, i.e. Sem in object(Ident,o(Cat,Phon,Sem))
fs(+Path) (extracts the feature structure at path Path; and displays the result as a feature structure in matrix notation. In such a Path the prefix might consist of integers to refer to daughters in a tree/3 tree structure; 0 is the root node of a local tree.)
fs (feature structure in matrix notation)
term(print) output as a Prolog term, using print where appropriate (in order that any application-specific portray/1 hook predicates will be applicable)
term(write) same as term(print), but not using print.
tree(Format) displays as a tree using Format as the relevant tree-format. Such a tree-format is defined by clauses for the hook predicates graphic_path, graphic_daughter and graphic_label.
Medium is one of:
user (normal text to SICStus Prolog standard output).
tk (on a canvas of the graphical user interface).
latex (latex code is input to latex and either xdvi or dvips followed by ghostview).
clig (using the CLiG system).
and Things is a list where each element is one of:
clause(Head,Body), Body a list of goals.
Displays Term as a tree according to the TreeFormat specifications, in Ghostview. This predicate produces LaTeX code (with PsTricks extensions); it runs LaTeX and dvips on the result. The TreeFormat should be specified by means of clauses for the hook predicates graphic_path, graphic_daughter and graphic_label.
Displays each Term in ListOfTerms as a tree according to the TreeFormat specifications, in Ghostview. This predicate produces LaTeX code (with PsTricks extensions); it runs LaTeX and dvips on the result. The TreeFormat should be specified by means of clauses for the hook predicates graphic_path, graphic_daughter and graphic_label.
Displays Term as a feature structure in Xdvi. The predicate produces LaTeX code (using Chris Manning's avm macro's); it runs LaTeX and xdvi on the result.
Displays each Term in List as a feature structure in Xdvi. The predicate produces LaTeX code (using Chris Manning's avm macro's); it runs LaTeX and xdvi on the result.
Displays Term in Xdvi. The predicate produces LaTeX code; it runs LaTeX and xdvi on the result.
Displays each Term in List in Xdvi. The predicate produces LaTeX code; it runs LaTeX and xdvi on the result.
generates from the semantic representation Sem. Sem is first filtered through the hook predicate extern_sem.
parses from the phonological representation Phon; typically Phon is a list of atoms, refer to the extern_phon hook predicate for more complex possibilities.
generated from the semantic representation of object Integer. Only the semantic representation of that object is passed to the generator.
Lists all available parsers and generators, and their associated activity status. During parser comparison and generator comparison, only those parsers and generators are compared which are currenly active.
Results of parsing and generation are normally added to the database. This predicate can be used to fetch such an object. The first argument is an integer used as the key of the object, the second argument is a triple o(Cat,Phon,Sem).
Without an argument, removes all results of parser comparison and generator comparison runs. With an argument, only remove information concerning that particular parser or generator.
Without arguments, compares active parsers on all sentences in test suite. With an argument, Keys is a list of keys which relate to the first argument of the sentence hook predicate. The active parsers will be compared on sentences with a matching key.
Without arguments, compares active generators for all logical forms of test suite. With an argument, Keys is a list of keys which relate to the first argument of the lf hook predicate. Only the logical forms with a matching key are compared.
lists all sentences in test-suite
lists all logical forms in test-suite
Compares active parsers on Sentence. In the binary format, Max is an integer indicating the maximum amount of msec.
Compares active generators on Lf. In the binary format, Max is an integer indicating the maximum amount of msec.
This predicate will construct Module:user_clause/2 definitions based on the available Module:clause/2 clauses (if no Module is specified, user is assumed). In the body of these clauses feature constraints are expanded out. The user_clause predicate is used for graphical display of predicates defined in the grammar. So you have to add a (typically multifile) predicate user:user_clause(A,B) :- Module:user_clause(A,B) for each Module.