|
NAMElink-parser - parse natural language sentences using Link GrammarSYNOPSISlink-parser --helplink-parser --version link-parser [language|dict_location] [--quiet] [-<special_"!"_command>...] DESCRIPTIONlink-parser is the command-line wrapper to the link-grammar natural language parsing library. This library will parse English language sentences, generating linkage trees showing relationships between the subject, the verb, and various adjectives, adverbs, etc. in the sentence.EXAMPLElink-parser Starts the parser interactive shell. Enter any sentence to parse: linkparser> Reading a man page is informative. Found 18 linkages (18 had no P.P. violations) Linkage 1, cost vector = (UNUSED=0 DIS= 0.00 LEN=16) +------------------------Xp------------------------+ +--------------->WV-------------->+ | | +----------Ss*g---------+ | | +--------Os-------+ | | | | +---Ds**x---+ | | +--->Wd---+ +-PHc+---A--+ +---Pa---+ | | | | | | | | | LEFT-WALL reading.g a man.ij page.n is.v informative.a . BACKGROUNDThe link-parser command-line tool is useful for general exploration and use, although it is presumed that, for the parsing of large quantities of text, a custom application, making use of the link-grammar library, will be written. Several such applications are described on the Link Grammar web page (see SEE ALSO below); these include the AbiWord grammar checker, and the RelEx semantic relation extractor.The theory of Link Grammar is explained in many academic papers. In the first of these, Daniel Sleator and Davy Temperley, "Parsing English with a Link Grammar" (1991), the authors defined a new formal grammatical system called a "link grammar". A sequence of words is in the language of a link grammar if there is a way to draw "links" between words in such a way that the local requirements of each word are satisfied, the links do not cross, and the words form a consistent connected graph. The authors encoded English grammar into such a system, and wrote link-parser to parse English using this grammar. The engine that performs the parsing is separate from the dictionaries describing a language. Currently, the most fully developed, complete dictionaries are for the English and Russian languages, although experimental, incomplete dictionaries exist for German, and several other languages. OVERVIEWlink-parser, when invoked manually, starts an interactive shell, taking control of the terminal. Any lines beginning with an exclamation mark are assumed to be a "special command"; these are described below. The command !help will provide more info; the command !variables will print all of the special commands. These are also called "variables", as almost all commands have a value associated with them: the command typically enable or disable some function, or they alter some multi-valued setting.All other input is treated as a single, English-language sentence; it is parsed, and the result of the parse is printed. The variables control what is printed: By default, an ASCII-graphics linkage is printed, although post-script output is also possible. The printing of the constituent tree can also be enabled. Other output controls include the printing of disjuncts and complete link data. In order to analyze sentences, link-parser depends on a link-grammar dictionary. This contains lists of words and associated metadata about their grammatical properties. An English language dictionary is provided by default. If other language dictionaries are installed in the default search locations, these may be explicitly specified by means of a 2-letter ISO language code: so, for example: link-parser de will start the parser shell with the German dictionary. Alternately, the dictionary location can be specified explicitly with either an absolute or a relative file path; so, for example: link-parser /usr/share/link-grammar/en will run link-parser using the English dictionary located in the typical install directory. link-parser can also be used in a non-interactive mode ("batch mode") via the -batch option (a special command, see below): So, for example: cat thesis.txt | link-parser -batch will read lines from the file thesis.txt, processing each
one as a complete sentence. For sentences that don't have a full parse, it
will print
Alternately, an input file may be specified with the !file filename special command, described below. Note that using "batch mode" disables the usual ASCII-graphics linkage printing. The input sentences also don't appear by default on stdout. These features may be re-enabled via special commands; special commands may be interspersed with the input. Instead of specifying -batch in the command-line, !batch can be specified in the said input file. For more details, use !help batch in link-parser's interactive shell. OPTIONS
Special ! commandsThe special "!" commands can be specified as command-line options in the command-line, or within the interactive shell itself by prefixing them with "!" on line start. The full option name does not need to be used; only enough letters to make the option unique must be specified.When specifying as a command-line option, a special command is proceeded by "-" instead of "!". Boolean variables may be toggled simply by giving the !varname, for example, !batch. Setting other variables require using an equals sign: !varname=value, for example, !width=100. The !help command prints general help. When issued from the interactive shell, it can get an argument, usually a special command. The !variables command prints all of the current variable settings. The !file command reads input from its argument file. The !file command is not a variable; it cannot be set. It can be used repeatedly. The !exit command instructs link-parser to exit. The exclamation mark "!" is also a special command by itself, used to inspect the dictionary entry for any given word (optionally terminated by a subscript). Thus two exclamation marks are needed before such a word when doing so from the interactive shell. The wildcard character "*" can be specified as the last character of the word in order to find multiple matches. Default values of the special commands below are shown in
parenthesis. Most of them are the default ones of the link-grammar library.
The following notations are used for words in the
sentence:
FILESThe following files are per-language, when LL is the 2-letter ISO language code.
SEE ALSOInformation on the link-grammar shared-library API and the link types used in the parse is available at the AbiWord website.Peer-reviewed papers explaining Link Grammar can be found at original CMU site. The source code of link-parser and the link-grammar library is located at GitHub. The mailing list for Link Grammar discussion is at link-grammar Google group. AUTHORlink-parser and the link-grammar library were written by Daniel Sleator <sleator@cs.cmu.edu>, Davy Temperley <dtemp@theory.esm.rochester.edu>, and John Lafferty <lafferty@cs.cmu.edu>This manual page was written by Ken Bloom <kbloom@gmail.com>, for the Debian project, and updated by Linas Vepstas <linasvepstas@gmail.com>.
Visit the GSP FreeBSD Man Page Interface. |