diff --git a/doc/gf-help-full.txt b/doc/gf-help-full.txt index 4c1ed8de4..309ee7700 100644 --- a/doc/gf-help-full.txt +++ b/doc/gf-help-full.txt @@ -1,38 +1,57 @@ -!, -system command: escape to system shell +#VSPACE -syntax: - ! SYSTEMCOMMAND +#NOINDENT +``!``: //system command: escape to system shell.// + +#TINY -options: +- Syntax: ``! SYSTEMCOMMAND`` +- Options: -flags: -examples: +- Flags: + + +- Examples: +``` ! ls *.gf -- list all GF files in the working directory +``` -?, -system pipe: send value from previous command to a system command - -syntax: - ? SYSTEMCOMMAND +#NORMAL -options: +#VSPACE -flags: +#NOINDENT +``?``: //system pipe: send value from previous command to a system command.// -examples: +#TINY + + +- Syntax: ``? SYSTEMCOMMAND`` +- Options: + + +- Flags: + + +- Examples: +``` gt | l | ? wc -- generate, linearize, word-count +``` -ai, abstract_info -Provides an information about a function, an expression or a category from the abstract syntax +#NORMAL -syntax: - ai IDENTIFIER or ai EXPR + +#VSPACE + +#NOINDENT +``ai`` = ``abstract_info``: //Provides an information about a function, an expression or a category from the abstract syntax.// + +#TINY The command has one argument which is either function, expression or a category defined in the abstract syntax of the current grammar. @@ -41,18 +60,27 @@ If it is a category then the category definition is printed. If a whole expression is given it prints the expression with refined metavariables and the type of the expression. -options: - -flags: - -examples: +- Syntax: ``ai IDENTIFIER or ai EXPR`` +- Options: -aw, align_words -show word alignments between languages graphically +- Flags: -syntax: - + +- Examples: +``` + +``` + +#NORMAL + + +#VSPACE + +#NOINDENT +``aw`` = ``align_words``: //show word alignments between languages graphically.// + +#TINY Prints a set of strings in the .dot format (the graphviz format). The graph can be saved in a file by the wf command as usual. @@ -61,26 +89,35 @@ which is processed by graphviz and displayed by the program indicated by the flag. The target format is postscript, unless overridden by the flag -format. -options: - -giza show alignments in the Giza format; the first two languages +- Syntax: +- Options: -flags: - -format format of the visualization file (default "png") - -lang alignments for this list of languages (default: all) - -view program to open the resulting file + | ``-giza`` | show alignments in the Giza format; the first two languages -examples: +- Flags: + + | ``-format`` | format of the visualization file (default "png") + | ``-lang`` | alignments for this list of languages (default: all) + | ``-view`` | program to open the resulting file + +- Examples: +``` gr | aw -- generate a tree and show word alignment as graph script gr | aw -view="open" -- generate a tree and display alignment on Mac gr | aw -view="eog" -- generate a tree and display alignment on Ubuntu gt | aw -giza | wf -file=aligns -- generate trees, send giza alignments to file +``` -ca, clitic_analyse -print the analyses of all words into stems and clitics +#NORMAL -syntax: - + +#VSPACE + +#NOINDENT +``ca`` = ``clitic_analyse``: //print the analyses of all words into stems and clitics.// + +#TINY Analyses all words into all possible combinations of stem + clitics. The analysis is returned in the format stem &+ clitic1 &+ clitic2 ... @@ -88,22 +125,31 @@ which is hence the inverse of 'pt -bind'. The list of clitics is give by the flag '-clitics'. The list of stems is given as the list of words of the language given by the '-lang' flag. -options: - -raw analyse each word separately (not suitable input for parser) +- Syntax: +- Options: -flags: - -clitics the list of possible clitics (comma-separated, no spaces) - -lang the language of analysis + | ``-raw`` | analyse each word separately (not suitable input for parser) -examples: +- Flags: + + | ``-clitics`` | the list of possible clitics (comma-separated, no spaces) + | ``-lang`` | the language of analysis + +- Examples: +``` ca -lang=Fin -clitics=ko,ni "nukkuuko minun vaimoni" | p -- to parse Finnish +``` -cc, compute_concrete -computes concrete syntax term using a source grammar +#NORMAL -syntax: - cc (-all | -table | -unqual)? TERM + +#VSPACE + +#NOINDENT +``cc`` = ``compute_concrete``: //computes concrete syntax term using a source grammar.// + +#TINY Compute TERM by concrete syntax definitions. Uses the topmost module (the last one imported) to resolve constant names. @@ -114,23 +160,32 @@ and hence not a valid input to a Tree-expecting command. This command must be a line of its own, and thus cannot be a part of a pipe. -options: - -all pick all strings (forms and variants) from records and tables - -list all strings, comma-separated on one line - -one pick the first strings, if there is any, from records and tables - -table show all strings labelled by parameters - -unqual hide qualifying module names +- Syntax: ``cc (-all | -table | -unqual)? TERM`` +- Options: -flags: + | ``-all`` | pick all strings (forms and variants) from records and tables + | ``-list`` | all strings, comma-separated on one line + | ``-one`` | pick the first strings, if there is any, from records and tables + | ``-table`` | show all strings labelled by parameters + | ``-unqual`` | hide qualifying module names -examples: +- Flags: -dc, define_command -define a command macro +- Examples: +``` -syntax: - dc IDENT COMMANDLINE +``` + +#NORMAL + + +#VSPACE + +#NOINDENT +``dc`` = ``define_command``: //define a command macro.// + +#TINY Defines IDENT as macro for COMMANDLINE, until IDENT gets redefined. A call of the command has the form %IDENT. The command may take an @@ -139,18 +194,27 @@ trees can be arguments. Currently at most one argument is possible. This command must be a line of its own, and thus cannot be a part of a pipe. -options: - -flags: - -examples: +- Syntax: ``dc IDENT COMMANDLINE`` +- Options: -dg, dependency_graph -print module dependency graph +- Flags: -syntax: - dg (-only=MODULES)? + +- Examples: +``` + +``` + +#NORMAL + + +#VSPACE + +#NOINDENT +``dg`` = ``dependency_graph``: //print module dependency graph.// + +#TINY Prints the dependency graph of source modules. Requires that import has been done with the -retain flag. @@ -164,20 +228,29 @@ exactly the same name. The graphical conventions are: solid arrow empty head = of, solid arrow = **, dashed arrow = open dotted arrow = other dependency -options: +- Syntax: ``dg (-only=MODULES)?`` +- Options: -flags: - -only list of modules included (default: all), literally or by prefix* -examples: +- Flags: + + | ``-only`` | list of modules included (default: all), literally or by prefix* + +- Examples: +``` dg -only=SyntaxEng,Food* -- shows only SyntaxEng, and those with prefix Food +``` -dt, define_tree -define a tree or string macro +#NORMAL -syntax: - dt IDENT (TREE | STRING | "<" COMMANDLINE) + +#VSPACE + +#NOINDENT +``dt`` = ``define_tree``: //define a tree or string macro.// + +#TINY Defines IDENT as macro for TREE or STRING, until IDENT gets redefined. The defining value can also come from a command, preceded by "<". @@ -186,36 +259,54 @@ A use of the macro has the form %IDENT. Currently this use cannot be a subtree of another tree. This command must be a line of its own and thus cannot be a part of a pipe. -options: +- Syntax: ``dt IDENT (TREE | STRING | "<" COMMANDLINE)`` +- Options: -flags: -examples: +- Flags: + + +- Examples: +``` dt ex "hello world" -- define ex as string dt ex UseN man_N -- define ex as string dt ex < p -cat=NP "the man in the car" -- define ex as parse result l -lang=LangSwe %ex | ps -to_utf8 -- linearize the tree ex +``` -e, empty -empty the environment - -syntax: - +#NORMAL -options: +#VSPACE -flags: +#NOINDENT +``e`` = ``empty``: //empty the environment.// -examples: +#TINY -eb, example_based -converts .gfe files to .gf files by parsing examples to trees +- Syntax: +- Options: -syntax: - eb (-probs=FILE | -lang=LANG)* -file=FILE.gfe + +- Flags: + + +- Examples: +``` + +``` + +#NORMAL + + +#VSPACE + +#NOINDENT +``eb`` = ``example_based``: //converts .gfe files to .gf files by parsing examples to trees.// + +#TINY Reads FILE.gfe and writes FILE.gf. Each expression of form '%ex CAT QUOTEDSTRING' in FILE.gfe is replaced by a syntax tree. @@ -226,96 +317,133 @@ The probabilities flag and configuration file is similar to the commands gr and rt. Notice that the command doesn't change the environment, but the resulting .gf file must be imported separately. -options: - -api convert trees to overloaded API expressions (using Syntax not Lang) +- Syntax: ``eb (-probs=FILE | -lang=LANG)* -file=FILE.gfe`` +- Options: -flags: - -file the file to be converted (suffix .gfe must be given) - -lang the language in which to parse - -probs file with probabilities to rank the parses + | ``-api`` | convert trees to overloaded API expressions (using Syntax not Lang) -examples: +- Flags: + + | ``-file`` | the file to be converted (suffix .gfe must be given) + | ``-lang`` | the language in which to parse + | ``-probs`` | file with probabilities to rank the parses + +- Examples: +``` + +``` + +#NORMAL -gr, generate_random -generate random trees in the current abstract syntax +#VSPACE -syntax: - gr [-cat=CAT] [-number=INT] +#NOINDENT +``gr`` = ``generate_random``: //generate random trees in the current abstract syntax.// + +#TINY Generates a list of random trees, by default one tree. If a tree argument is given, the command completes the Tree with values to all metavariables in the tree. The generation can be biased by probabilities, given in a file in the -probs flag. -options: +- Syntax: ``gr [-cat=CAT] [-number=INT]`` +- Options: -flags: - -cat generation category - -lang uses only functions that have linearizations in all these languages - -number number of trees generated - -depth the maximum generation depth - -probs file with biased probabilities (format 'f 0.4' one by line) -examples: +- Flags: + + | ``-cat`` | generation category + | ``-lang`` | uses only functions that have linearizations in all these languages + | ``-number`` | number of trees generated + | ``-depth`` | the maximum generation depth + | ``-probs`` | file with biased probabilities (format 'f 0.4' one by line) + +- Examples: +``` gr -- one tree in the startcat of the current grammar gr -cat=NP -number=16 -- 16 trees in the category NP gr -lang=LangHin,LangTha -cat=Cl -- Cl, both in LangHin and LangTha gr -probs=FILE -- generate with bias gr (AdjCN ? (UseN ?)) -- generate trees of form (AdjCN ? (UseN ?)) +``` -gt, generate_trees -generates a list of trees, by default exhaustive +#NORMAL -syntax: - + +#VSPACE + +#NOINDENT +``gt`` = ``generate_trees``: //generates a list of trees, by default exhaustive.// + +#TINY Generates all trees of a given category, with increasing depth. By default, the depth is 4, but this can be changed by a flag. If a Tree argument is given, the command completes the Tree with values to all metavariables in the tree. -options: +- Syntax: +- Options: -flags: - -cat the generation category - -depth the maximum generation depth - -lang excludes functions that have no linearization in this language - -number the number of trees generated -examples: +- Flags: + + | ``-cat`` | the generation category + | ``-depth`` | the maximum generation depth + | ``-lang`` | excludes functions that have no linearization in this language + | ``-number`` | the number of trees generated + +- Examples: +``` gt -- all trees in the startcat, to depth 4 gt -cat=NP -number=16 -- 16 trees in the category NP gt -cat=NP -depth=2 -- trees in the category NP to depth 2 gt (AdjCN ? (UseN ?)) -- trees of form (AdjCN ? (UseN ?)) +``` -h, help -get description of a command, or a the full list of commands +#NORMAL -syntax: - h (-full)? COMMAND? + +#VSPACE + +#NOINDENT +``h`` = ``help``: //get description of a command, or a the full list of commands.// + +#TINY Displays information concerning the COMMAND. Without argument, shows the synopsis of all commands. -options: - -changes give a summary of changes from GF 2.9 - -coding give advice on character encoding - -full give full information of the commands - -license show copyright and license information +- Syntax: ``h (-full)? COMMAND?`` +- Options: -flags: + | ``-changes`` | give a summary of changes from GF 2.9 + | ``-coding`` | give advice on character encoding + | ``-full`` | give full information of the commands + | ``-license`` | show copyright and license information + | ``-t2t`` | format help for txt2tags -examples: +- Flags: -i, import -import a grammar from source code or compiled .pgf file +- Examples: +``` -syntax: - +``` + +#NORMAL + + +#VSPACE + +#NOINDENT +``i`` = ``import``: //import a grammar from source code or compiled .pgf file.// + +#TINY Reads a grammar from File and compiles it into a GF runtime grammar. If its abstract is different from current state, old modules are discarded. @@ -329,22 +457,31 @@ The grammar parser depends on the file name suffix: .gfo compiled GF source .pgf precompiled grammar in Portable Grammar Format -options: - -retain retain operations (used for cc command) - -src force compilation from source - -v be verbose - show intermediate status information +- Syntax: +- Options: -flags: - -probs file with biased probabilities for generation + | ``-retain`` | retain operations (used for cc command) + | ``-src`` | force compilation from source + | ``-v`` | be verbose - show intermediate status information -examples: +- Flags: + + | ``-probs`` | file with biased probabilities for generation + +- Examples: +``` + +``` + +#NORMAL -l, linearize -convert an abstract syntax expression to string +#VSPACE -syntax: - +#NOINDENT +``l`` = ``linearize``: //convert an abstract syntax expression to string.// + +#TINY Shows the linearization of a Tree by the grammars in scope. The -lang flag can be used to restrict this to fewer languages. @@ -356,104 +493,131 @@ whose results are prepended to the other lexer flags. The value of the unlexer flag is a space-separated list of comma-separated string operation sequences; see example. -options: - -all show all forms and variants, one by line (cf. l -list) - -bracket show tree structure with brackets and paths to nodes - -groups all languages, grouped by lang, remove duplicate strings - -list show all forms and variants, comma-separated on one line (cf. l -all) - -multi linearize to all languages (default) - -table show all forms labelled by parameters - -treebank show the tree and tag linearizations with language names - -bind bind tokens separated by Prelude.BIND, i.e. &+ - -chars lexer that makes every non-space character a token - -from_amharic from unicode to GF Amharic transliteration - -from_ancientgreek from unicode to GF ancient Greek transliteration - -from_arabic from unicode to GF Arabic transliteration - -from_cp1251 decode from cp1251 (Cyrillic used in Bulgarian resource) - -from_devanagari from unicode to GF Devanagari transliteration - -from_greek from unicode to GF modern Greek transliteration - -from_hebrew from unicode to GF unvocalized Hebrew transliteration - -from_nepali from unicode to GF Nepali transliteration - -from_persian from unicode to GF Persian/Farsi transliteration - -from_telugu from unicode to GF Telugu transliteration - -from_thai from unicode to GF Thai transliteration - -from_urdu from unicode to GF Urdu transliteration - -from_utf8 decode from utf8 (default) - -lexcode code-like lexer - -lexmixed mixture of text and code (code between $...$) - -lextext text-like lexer - -to_amharic from GF Amharic transliteration to unicode - -to_ancientgreek from GF ancient Greek transliteration to unicode - -to_arabic from GF Arabic transliteration to unicode - -to_cp1251 encode to cp1251 (Cyrillic used in Bulgarian resource) - -to_devanagari from GF Devanagari transliteration to unicode - -to_greek from GF modern Greek transliteration to unicode - -to_hebrew from GF unvocalized Hebrew transliteration to unicode - -to_html wrap in a html file with linebreaks - -to_nepali from GF Nepali transliteration to unicode - -to_persian from GF Persian/Farsi transliteration to unicode - -to_telugu from GF Telugu transliteration to unicode - -to_thai from GF Thai transliteration to unicode - -to_urdu from GF Urdu transliteration to unicode - -to_utf8 encode to utf8 (default) - -unchars unlexer that puts no spaces between tokens - -unlexcode code-like unlexer - -unlexmixed mixture of text and code (code between $...$) - -unlextext text-like unlexer - -unwords unlexer that puts a single space between tokens (default) - -words lexer that assumes tokens separated by spaces (default) +- Syntax: +- Options: -flags: - -lang the languages of linearization (comma-separated, no spaces) - -unlexer set unlexers separately to each language (space-separated) + | ``-all`` | show all forms and variants, one by line (cf. l -list) + | ``-bracket`` | show tree structure with brackets and paths to nodes + | ``-groups`` | all languages, grouped by lang, remove duplicate strings + | ``-list`` | show all forms and variants, comma-separated on one line (cf. l -all) + | ``-multi`` | linearize to all languages (default) + | ``-table`` | show all forms labelled by parameters + | ``-treebank`` | show the tree and tag linearizations with language names + | ``-bind`` | bind tokens separated by Prelude.BIND, i.e. &+ + | ``-chars`` | lexer that makes every non-space character a token + | ``-from_amharic`` | from unicode to GF Amharic transliteration + | ``-from_ancientgreek`` | from unicode to GF ancient Greek transliteration + | ``-from_arabic`` | from unicode to GF Arabic transliteration + | ``-from_cp1251`` | decode from cp1251 (Cyrillic used in Bulgarian resource) + | ``-from_devanagari`` | from unicode to GF Devanagari transliteration + | ``-from_greek`` | from unicode to GF modern Greek transliteration + | ``-from_hebrew`` | from unicode to GF unvocalized Hebrew transliteration + | ``-from_nepali`` | from unicode to GF Nepali transliteration + | ``-from_persian`` | from unicode to GF Persian/Farsi transliteration + | ``-from_telugu`` | from unicode to GF Telugu transliteration + | ``-from_thai`` | from unicode to GF Thai transliteration + | ``-from_urdu`` | from unicode to GF Urdu transliteration + | ``-from_utf8`` | decode from utf8 (default) + | ``-lexcode`` | code-like lexer + | ``-lexmixed`` | mixture of text and code (code between $...$) + | ``-lextext`` | text-like lexer + | ``-to_amharic`` | from GF Amharic transliteration to unicode + | ``-to_ancientgreek`` | from GF ancient Greek transliteration to unicode + | ``-to_arabic`` | from GF Arabic transliteration to unicode + | ``-to_cp1251`` | encode to cp1251 (Cyrillic used in Bulgarian resource) + | ``-to_devanagari`` | from GF Devanagari transliteration to unicode + | ``-to_greek`` | from GF modern Greek transliteration to unicode + | ``-to_hebrew`` | from GF unvocalized Hebrew transliteration to unicode + | ``-to_html`` | wrap in a html file with linebreaks + | ``-to_nepali`` | from GF Nepali transliteration to unicode + | ``-to_persian`` | from GF Persian/Farsi transliteration to unicode + | ``-to_telugu`` | from GF Telugu transliteration to unicode + | ``-to_thai`` | from GF Thai transliteration to unicode + | ``-to_urdu`` | from GF Urdu transliteration to unicode + | ``-to_utf8`` | encode to utf8 (default) + | ``-unchars`` | unlexer that puts no spaces between tokens + | ``-unlexcode`` | code-like unlexer + | ``-unlexmixed`` | mixture of text and code (code between $...$) + | ``-unlextext`` | text-like unlexer + | ``-unwords`` | unlexer that puts a single space between tokens (default) + | ``-words`` | lexer that assumes tokens separated by spaces (default) -examples: +- Flags: + + | ``-lang`` | the languages of linearization (comma-separated, no spaces) + | ``-unlexer`` | set unlexers separately to each language (space-separated) + +- Examples: +``` l -lang=LangSwe,LangNor no_Utt -- linearize tree to LangSwe and LangNor gr -lang=LangHin -cat=Cl | l -table -to_devanagari -- hindi table l -unlexer="LangAra=to_arabic LangHin=to_devanagari" -- different unlexers +``` -ma, morpho_analyse -print the morphological analyses of all words in the string +#NORMAL -syntax: - + +#VSPACE + +#NOINDENT +``ma`` = ``morpho_analyse``: //print the morphological analyses of all words in the string.// + +#TINY Prints all the analyses of space-separated words in the input string, using the morphological analyser of the actual grammar (see command pg) -options: - -missing show the list of unknown words in the input +- Syntax: +- Options: -flags: - -lang the languages of analysis (comma-separated, no spaces) + | ``-missing`` | show the list of unknown words in the input -examples: +- Flags: + + | ``-lang`` | the languages of analysis (comma-separated, no spaces) + +- Examples: +``` + +``` + +#NORMAL -mq, morpho_quiz -start a morphology quiz +#VSPACE -syntax: - mq (-cat=CAT)? (-probs=FILE)? TREE? +#NOINDENT +``mq`` = ``morpho_quiz``: //start a morphology quiz.// + +#TINY -options: - -flags: - -lang language of the quiz - -cat category of the quiz - -number maximum number of questions - -probs file with biased probabilities for generation - -examples: +- Syntax: ``mq (-cat=CAT)? (-probs=FILE)? TREE?`` +- Options: -p, parse -parse a string to abstract syntax expression +- Flags: -syntax: - + | ``-lang`` | language of the quiz + | ``-cat`` | category of the quiz + | ``-number`` | maximum number of questions + | ``-probs`` | file with biased probabilities for generation + +- Examples: +``` + +``` + +#NORMAL + + +#VSPACE + +#NOINDENT +``p`` = ``parse``: //parse a string to abstract syntax expression.// + +#TINY Shows all trees returned by parsing a string in the grammars in scope. The -lang flag can be used to restrict this to fewer languages. @@ -464,23 +628,32 @@ The -openclass flag is experimental and allows some robustness in the parser. For example if -openclass="A,N,V" is given, the parser will accept unknown adjectives, nouns and verbs with the resource grammar. -options: - -bracket prints the bracketed string from the parser +- Syntax: +- Options: -flags: - -cat target category of parsing - -lang the languages of parsing (comma-separated, no spaces) - -openclass list of open-class categories for robust parsing - -depth maximal depth for proof search if the abstract syntax tree has meta variables + | ``-bracket`` | prints the bracketed string from the parser -examples: +- Flags: + + | ``-cat`` | target category of parsing + | ``-lang`` | the languages of parsing (comma-separated, no spaces) + | ``-openclass`` | list of open-class categories for robust parsing + | ``-depth`` | maximal depth for proof search if the abstract syntax tree has meta variables + +- Examples: +``` + +``` + +#NORMAL -pg, print_grammar -print the actual grammar with the given printer +#VSPACE -syntax: - +#NOINDENT +``pg`` = ``print_grammar``: //print the actual grammar with the given printer.// + +#TINY Prints the actual grammar, with all involved languages. In some printers, this can be restricted to a subset of languages @@ -512,49 +685,67 @@ command (flag -printer): srgs_xml_nonrec SRGS XML, recursion eliminated vxml Voice XML based on abstract syntax -options: - -cats show just the names of abstract syntax categories - -fullform print the fullform lexicon - -funs show just the names and types of abstract syntax functions - -langs show just the names of top concrete syntax modules - -lexc print the lexicon in Xerox LEXC format - -missing show just the names of functions that have no linearization - -opt optimize the generated pgf - -pgf write current pgf image in file - -words print the list of words +- Syntax: +- Options: -flags: - -file set the file name when printing with -pgf option - -lang select languages for the some options (default all languages) - -printer select the printing format (see flag values above) + | ``-cats`` | show just the names of abstract syntax categories + | ``-fullform`` | print the fullform lexicon + | ``-funs`` | show just the names and types of abstract syntax functions + | ``-langs`` | show just the names of top concrete syntax modules + | ``-lexc`` | print the lexicon in Xerox LEXC format + | ``-missing`` | show just the names of functions that have no linearization + | ``-opt`` | optimize the generated pgf + | ``-pgf`` | write current pgf image in file + | ``-words`` | print the list of words -examples: +- Flags: + + | ``-file`` | set the file name when printing with -pgf option + | ``-lang`` | select languages for the some options (default all languages) + | ``-printer`` | select the printing format (see flag values above) + +- Examples: +``` pg -funs | ? grep " S ;" -- show functions with value cat S +``` -ph, print_history -print command history +#NORMAL -syntax: - + +#VSPACE + +#NOINDENT +``ph`` = ``print_history``: //print command history.// + +#TINY Prints the commands issued during the GF session. The result is readable by the eh command. The result can be used as a script when starting GF. -options: +- Syntax: +- Options: -flags: -examples: +- Flags: + + +- Examples: +``` ph | wf -file=foo.gfs -- save the history into a file +``` -ps, put_string -return a string, possibly processed with a function +#NORMAL -syntax: - ps OPT? STRING + +#VSPACE + +#NOINDENT +``ps`` = ``put_string``: //return a string, possibly processed with a function.// + +#TINY Returns a string obtained from its argument string by applying string processing functions in the order given in the command line @@ -563,52 +754,56 @@ are lexers and unlexers, but also character encoding conversions are possible. The unlexers preserve the division of their input to lines. To see transliteration tables, use command ut. -options: - -bind bind tokens separated by Prelude.BIND, i.e. &+ - -chars lexer that makes every non-space character a token - -from_amharic from unicode to GF Amharic transliteration - -from_ancientgreek from unicode to GF ancient Greek transliteration - -from_arabic from unicode to GF Arabic transliteration - -from_cp1251 decode from cp1251 (Cyrillic used in Bulgarian resource) - -from_devanagari from unicode to GF Devanagari transliteration - -from_greek from unicode to GF modern Greek transliteration - -from_hebrew from unicode to GF unvocalized Hebrew transliteration - -from_nepali from unicode to GF Nepali transliteration - -from_persian from unicode to GF Persian/Farsi transliteration - -from_telugu from unicode to GF Telugu transliteration - -from_thai from unicode to GF Thai transliteration - -from_urdu from unicode to GF Urdu transliteration - -from_utf8 decode from utf8 (default) - -lexcode code-like lexer - -lexmixed mixture of text and code (code between $...$) - -lextext text-like lexer - -to_amharic from GF Amharic transliteration to unicode - -to_ancientgreek from GF ancient Greek transliteration to unicode - -to_arabic from GF Arabic transliteration to unicode - -to_cp1251 encode to cp1251 (Cyrillic used in Bulgarian resource) - -to_devanagari from GF Devanagari transliteration to unicode - -to_greek from GF modern Greek transliteration to unicode - -to_hebrew from GF unvocalized Hebrew transliteration to unicode - -to_html wrap in a html file with linebreaks - -to_nepali from GF Nepali transliteration to unicode - -to_persian from GF Persian/Farsi transliteration to unicode - -to_telugu from GF Telugu transliteration to unicode - -to_thai from GF Thai transliteration to unicode - -to_urdu from GF Urdu transliteration to unicode - -to_utf8 encode to utf8 (default) - -unchars unlexer that puts no spaces between tokens - -unlexcode code-like unlexer - -unlexmixed mixture of text and code (code between $...$) - -unlextext text-like unlexer - -unwords unlexer that puts a single space between tokens (default) - -words lexer that assumes tokens separated by spaces (default) +- Syntax: ``ps OPT? STRING`` +- Options: -flags: - -env apply in this environment only - -from backward-apply transliteration defined in this file (format 'unicode translit' per line) - -to forward-apply transliteration defined in this file + | ``-bind`` | bind tokens separated by Prelude.BIND, i.e. &+ + | ``-chars`` | lexer that makes every non-space character a token + | ``-from_amharic`` | from unicode to GF Amharic transliteration + | ``-from_ancientgreek`` | from unicode to GF ancient Greek transliteration + | ``-from_arabic`` | from unicode to GF Arabic transliteration + | ``-from_cp1251`` | decode from cp1251 (Cyrillic used in Bulgarian resource) + | ``-from_devanagari`` | from unicode to GF Devanagari transliteration + | ``-from_greek`` | from unicode to GF modern Greek transliteration + | ``-from_hebrew`` | from unicode to GF unvocalized Hebrew transliteration + | ``-from_nepali`` | from unicode to GF Nepali transliteration + | ``-from_persian`` | from unicode to GF Persian/Farsi transliteration + | ``-from_telugu`` | from unicode to GF Telugu transliteration + | ``-from_thai`` | from unicode to GF Thai transliteration + | ``-from_urdu`` | from unicode to GF Urdu transliteration + | ``-from_utf8`` | decode from utf8 (default) + | ``-lexcode`` | code-like lexer + | ``-lexmixed`` | mixture of text and code (code between $...$) + | ``-lextext`` | text-like lexer + | ``-to_amharic`` | from GF Amharic transliteration to unicode + | ``-to_ancientgreek`` | from GF ancient Greek transliteration to unicode + | ``-to_arabic`` | from GF Arabic transliteration to unicode + | ``-to_cp1251`` | encode to cp1251 (Cyrillic used in Bulgarian resource) + | ``-to_devanagari`` | from GF Devanagari transliteration to unicode + | ``-to_greek`` | from GF modern Greek transliteration to unicode + | ``-to_hebrew`` | from GF unvocalized Hebrew transliteration to unicode + | ``-to_html`` | wrap in a html file with linebreaks + | ``-to_nepali`` | from GF Nepali transliteration to unicode + | ``-to_persian`` | from GF Persian/Farsi transliteration to unicode + | ``-to_telugu`` | from GF Telugu transliteration to unicode + | ``-to_thai`` | from GF Thai transliteration to unicode + | ``-to_urdu`` | from GF Urdu transliteration to unicode + | ``-to_utf8`` | encode to utf8 (default) + | ``-unchars`` | unlexer that puts no spaces between tokens + | ``-unlexcode`` | code-like unlexer + | ``-unlexmixed`` | mixture of text and code (code between $...$) + | ``-unlextext`` | text-like unlexer + | ``-unwords`` | unlexer that puts a single space between tokens (default) + | ``-words`` | lexer that assumes tokens separated by spaces (default) -examples: +- Flags: + + | ``-env`` | apply in this environment only + | ``-from`` | backward-apply transliteration defined in this file (format 'unicode translit' per line) + | ``-to`` | forward-apply transliteration defined in this file + +- Examples: +``` l (EAdd 3 4) | ps -code -- linearize code-like output ps -lexer=code | p -cat=Exp -- parse code-like input gr -cat=QCl | l | ps -bind -- linearization output from LangFin @@ -617,65 +812,97 @@ examples: rf -file=Ara.gf | ps -from_utf8 -env=quotes -from_arabic -- convert UTF8 to transliteration ps -to=chinese.trans "abc" -- apply transliteration defined in file chinese.trans +``` -pt, put_tree -return a tree, possibly processed with a function +#NORMAL -syntax: - ps OPT? TREE + +#VSPACE + +#NOINDENT +``pt`` = ``put_tree``: //return a tree, possibly processed with a function.// + +#TINY Returns a tree obtained from its argument tree by applying tree processing functions in the order given in the command line option list. Thus 'pt -f -g s' returns g (f s). Typical tree processors are type checking and semantic computation. -options: - -compute compute by using semantic definitions (def) - -paraphrase paraphrase by using semantic definitions (def) - -smallest sort trees from smallest to largest, in number of nodes +- Syntax: ``ps OPT? TREE`` +- Options: -flags: - -number take at most this many trees - -transfer syntactic transfer by applying function, recursively in subtrees + | ``-compute`` | compute by using semantic definitions (def) + | ``-paraphrase`` | paraphrase by using semantic definitions (def) + | ``-smallest`` | sort trees from smallest to largest, in number of nodes -examples: +- Flags: + + | ``-number`` | take at most this many trees + | ``-transfer`` | syntactic transfer by applying function, recursively in subtrees + +- Examples: +``` pt -compute (plus one two) -- compute value p "4 dogs love 5 cats" | pt -transfer=digits2numeral | l -- four...five... +``` -q, quit -exit GF interpreter - -syntax: - +#NORMAL -options: +#VSPACE -flags: +#NOINDENT +``q`` = ``quit``: //exit GF interpreter.// -examples: +#TINY -r, reload -repeat the latest import command - -syntax: - +- Syntax: +- Options: -options: - -flags: - -examples: +- Flags: -rf, read_file -read string or tree input from a file +- Examples: +``` -syntax: - +``` + +#NORMAL + + +#VSPACE + +#NOINDENT +``r`` = ``reload``: //repeat the latest import command.// + +#TINY + + +- Syntax: +- Options: + + +- Flags: + + +- Examples: +``` + +``` + +#NORMAL + + +#VSPACE + +#NOINDENT +``rf`` = ``read_file``: //read string or tree input from a file.// + +#TINY Reads input from file. The filename must be in double quotes. The input is interpreted as a string by default, and can hence be @@ -683,59 +910,86 @@ piped e.g. to the parse command. The option -tree interprets the input as a tree, which can be given e.g. to the linearize command. The option -lines will result in a list of strings or trees, one by line. -options: - -lines return the list of lines, instead of the singleton of all contents - -tree convert strings into trees +- Syntax: +- Options: -flags: - -file the input file name + | ``-lines`` | return the list of lines, instead of the singleton of all contents + | ``-tree`` | convert strings into trees -examples: +- Flags: + + | ``-file`` | the input file name + +- Examples: +``` + +``` + +#NORMAL -rt, rank_trees -show trees in an order of decreasing probability +#VSPACE -syntax: - +#NOINDENT +``rt`` = ``rank_trees``: //show trees in an order of decreasing probability.// + +#TINY Order trees from the most to the least probable, using either even distribution in each category (default) or biased as specified by the file given by flag -probs=FILE, where each line has the form 'function probability', e.g. 'youPol_Pron 0.01'. -options: - -v show all trees with their probability scores +- Syntax: +- Options: -flags: - -probs probabilities from this file (format 'f 0.6' per line) + | ``-v`` | show all trees with their probability scores -examples: +- Flags: + + | ``-probs`` | probabilities from this file (format 'f 0.6' per line) + +- Examples: +``` p "you are here" | rt -probs=probs | pt -number=1 -- most probable result se utf8 -- set encoding to utf8 (default) +``` -se, set_encoding -set the encoding used in current terminal - -syntax: - se ID +#NORMAL -options: +#VSPACE -flags: +#NOINDENT +``se`` = ``set_encoding``: //set the encoding used in current terminal.// -examples: +#TINY + + +- Syntax: ``se ID`` +- Options: + + +- Flags: + + +- Examples: +``` se cp1251 -- set encoding to cp1521 se utf8 -- set encoding to utf8 (default) +``` -so, show_operations -show all operations in scope, possibly restricted to a value type +#NORMAL -syntax: - so (-grep=STRING)* TYPE? + +#VSPACE + +#NOINDENT +``so`` = ``show_operations``: //show all operations in scope, possibly restricted to a value type.// + +#TINY Show the names and type signatures of all operations available in the current resource. This command requires a source grammar to be in scope, imported with 'import -retain'. @@ -745,98 +999,143 @@ The grep STRINGs filter according to other substrings of the type signatures. This command must be a line of its own, and thus cannot be a part of a pipe. -options: - -raw show the types in computed forms (instead of category names) +- Syntax: ``so (-grep=STRING)* TYPE?`` +- Options: -flags: - -grep substring used for filtering (the command can have many of these) + | ``-raw`` | show the types in computed forms (instead of category names) -examples: +- Flags: + + | ``-grep`` | substring used for filtering (the command can have many of these) + +- Examples: +``` + +``` + +#NORMAL -sp, system_pipe -send argument to a system command +#VSPACE -syntax: - sp -command="SYSTEMCOMMAND", alt. ? SYSTEMCOMMAND +#NOINDENT +``sp`` = ``system_pipe``: //send argument to a system command.// + +#TINY -options: +- Syntax: ``sp -command="SYSTEMCOMMAND", alt. ? SYSTEMCOMMAND`` +- Options: -flags: - -command the system command applied to the argument -examples: +- Flags: + + | ``-command`` | the system command applied to the argument + +- Examples: +``` sp -command="wc" "foo" gt | l | sp -command="grep \"who\"" | sp -command="wc" +``` -t, tokenize -Tokenize string usng the vocabulary - -syntax: - +#NORMAL -options: +#VSPACE -flags: - -lang The name of the concrete to use +#NOINDENT +``t`` = ``tokenize``: //Tokenize string usng the vocabulary.// -examples: +#TINY -tq, translation_quiz -start a translation quiz - -syntax: - tq -from=LANG -to=LANG (-cat=CAT)? (-probs=FILE)? TREE? +- Syntax: +- Options: -options: +- Flags: -flags: - -from translate from this language - -to translate to this language - -cat translate in this category - -number the maximum number of questions - -probs file with biased probabilities for generation + | ``-lang`` | The name of the concrete to use -examples: +- Examples: +``` + +``` + +#NORMAL + + +#VSPACE + +#NOINDENT +``tq`` = ``translation_quiz``: //start a translation quiz.// + +#TINY + + +- Syntax: ``tq -from=LANG -to=LANG (-cat=CAT)? (-probs=FILE)? TREE?`` +- Options: + + +- Flags: + + | ``-from`` | translate from this language + | ``-to`` | translate to this language + | ``-cat`` | translate in this category + | ``-number`` | the maximum number of questions + | ``-probs`` | file with biased probabilities for generation + +- Examples: +``` tq -from=Eng -to=Swe -- any trees in startcat tq -from=Eng -to=Swe (AdjCN (PositA ?2) (UseN ?)) -- only trees of this form +``` -ut, unicode_table -show a transliteration table for a unicode character set - -syntax: - +#NORMAL -options: - -amharic Amharic - -ancientgreek ancient Greek - -arabic Arabic - -devanagari Devanagari - -greek modern Greek - -hebrew unvocalized Hebrew - -persian Persian/Farsi - -nepali Nepali - -telugu Telugu - -thai Thai - -urdu Urdu +#VSPACE -flags: +#NOINDENT +``ut`` = ``unicode_table``: //show a transliteration table for a unicode character set.// -examples: +#TINY -vd, visualize_dependency -show word dependency tree graphically +- Syntax: +- Options: -syntax: - + | ``-amharic`` | Amharic + | ``-ancientgreek`` | ancient Greek + | ``-arabic`` | Arabic + | ``-devanagari`` | Devanagari + | ``-greek`` | modern Greek + | ``-hebrew`` | unvocalized Hebrew + | ``-persian`` | Persian/Farsi + | ``-nepali`` | Nepali + | ``-telugu`` | Telugu + | ``-thai`` | Thai + | ``-urdu`` | Urdu + +- Flags: + + +- Examples: +``` + +``` + +#NORMAL + + +#VSPACE + +#NOINDENT +``vd`` = ``visualize_dependency``: //show word dependency tree graphically.// + +#TINY Prints a dependency tree in the .dot format (the graphviz format, default) or the MaltParser/CoNLL format (flag -output=malt for training, malt_input) @@ -849,27 +1148,36 @@ which is processed by graphviz and displayed by the program indicated by the flag. The target format is png, unless overridden by the flag -format. -options: - -v show extra information +- Syntax: +- Options: -flags: - -file configuration file for labels per fun, format 'fun l1 ... label ... l2' - -format format of the visualization file (default "png") - -output output format of graph source (default "dot") - -view program to open the resulting file (default "open") + | ``-v`` | show extra information -examples: +- Flags: + + | ``-file`` | configuration file for labels per fun, format 'fun l1 ... label ... l2' + | ``-format`` | format of the visualization file (default "png") + | ``-output`` | output format of graph source (default "dot") + | ``-view`` | program to open the resulting file (default "open") + +- Examples: +``` gr | vd -- generate a tree and show dependency tree in .dot gr | vd -view=open -- generate a tree and display dependency tree on a Mac gr -number=1000 | vd -file=dep.labels -output=malt -- generate training treebank gr -number=100 | vd -file=dep.labels -output=malt_input -- generate test sentences +``` -vp, visualize_parse -show parse tree graphically +#NORMAL -syntax: - + +#VSPACE + +#NOINDENT +``vp`` = ``visualize_parse``: //show parse tree graphically.// + +#TINY Prints a parse tree the .dot format (the graphviz format). The graph can be saved in a file by the wf command as usual. @@ -878,22 +1186,31 @@ which is processed by graphviz and displayed by the program indicated by the flag. The target format is png, unless overridden by the flag -format. -options: +- Syntax: +- Options: -flags: - -format format of the visualization file (default "png") - -view program to open the resulting file (default "open") -examples: +- Flags: + + | ``-format`` | format of the visualization file (default "png") + | ``-view`` | program to open the resulting file (default "open") + +- Examples: +``` p "John walks" | vp -- generate a tree and show parse tree as .dot script gr | vp -view="open" -- generate a tree and display parse tree on a Mac +``` -vt, visualize_tree -show a set of trees graphically +#NORMAL -syntax: - + +#VSPACE + +#NOINDENT +``vt`` = ``visualize_tree``: //show a set of trees graphically.// + +#TINY Prints a set of trees in the .dot format (the graphviz format). The graph can be saved in a file by the wf command as usual. @@ -903,32 +1220,52 @@ by the flag. The target format is postscript, unless overridden by the flag -format. With option -mk, use for showing library style function names of form 'mkC'. -options: - -api show the tree with function names converted to 'mkC' with value cats C - -mk similar to -api, deprecated - -nofun don't show functions but only categories - -nocat don't show categories but only functions +- Syntax: +- Options: -flags: - -format format of the visualization file (default "png") - -view program to open the resulting file (default "open") + | ``-api`` | show the tree with function names converted to 'mkC' with value cats C + | ``-mk`` | similar to -api, deprecated + | ``-nofun`` | don't show functions but only categories + | ``-nocat`` | don't show categories but only functions -examples: +- Flags: + + | ``-format`` | format of the visualization file (default "png") + | ``-view`` | program to open the resulting file (default "open") + +- Examples: +``` p "hello" | vt -- parse a string and show trees as graph script p "hello" | vt -view="open" -- parse a string and display trees on a Mac +``` -wf, write_file -send string or tree to a file - -syntax: - +#NORMAL -options: - -append append to file, instead of overwriting it +#VSPACE + +#NOINDENT +``wf`` = ``write_file``: //send string or tree to a file.// + +#TINY + + +- Syntax: +- Options: + + | ``-append`` | append to file, instead of overwriting it + +- Flags: + + | ``-file`` | the output filename + +- Examples: +``` + +``` + +#NORMAL + -flags: - -file the output filename -examples: diff --git a/doc/gf-shell-reference.t2t b/doc/gf-shell-reference.t2t index f9fa65cd3..a1f88ce74 100644 --- a/doc/gf-shell-reference.t2t +++ b/doc/gf-shell-reference.t2t @@ -3,6 +3,10 @@ The GF Software System %!style:../css/style.css %!postproc(html):

+%!postproc(html): "#VSPACE" "

" +%!postproc(html): "#NORMAL" "" +%!postproc(html): "#TINY" "" +%!postproc(html): "#NOINDENT" "" The GF software system implements the GF programming language. Its components are @@ -64,7 +68,7 @@ executed one by one, in the order of appearance. The full set of GF shell commands is listed below with explanations. This list can also be obtained in the GF shell by the command ``help -full``. -%!include: ``gf-help-full.txt`` +%!include: gf-help-full.txt ==The GF batch compiler==