LINK-PARSER(1)

NAME
link-parser - parse natural language sentences using Link Grammar

SYNOPSIS
link-parser --help
link-parser --version
link-parser [language|dict_location] [-<special_"!"_command>...]

DESCRIPTION

link-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.

EXAMPLE
    link-parser

Starts the parser interactive shell. Enter any sentence to parse:

    linkparser> Reading a man page is informative.
    Found 12 linkages (12 had no P.P. violations)
    	Linkage 1, cost vector = (UNUSED=0 DIS= 0.20 LEN=16)
        +------------------------Xp------------------------+
        +--------------->WV-------------->+                |
        |         +----------Ss*g---------+                |
        |         +--------Os-------+     |                |
        |         |     +---Ds**x---+     |                |
        +----Wd---+     |    +---A--+     +---Pa---+       |
        |         |     |    |      |     |        |       |
    LEFT-WALL reading.g a man.ij page.n is.v informative.a .

BACKGROUND
The 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.

OVERVIEW

link-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, complete link data, and word senses.

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 non-interactively, either through its API, or via the -batch option. When used with the -batch option, link-parser reads from standard input, generating output to standard out. So, for example:

        cat thesis.txt | link-parser -batch

Note that using the -batch option disables the usual ASCII-graphics linkage printing. This may be re-enabled via a special command; special commands may be interspersed with the input.

Alternately, an input file may be specified with the !file special command, described below.

OPTIONS

--help
    Print usage and exit.

--version
    Print version number and exit.

  Special ! options
The special "!" options can be specified either on the command-line, on startup, or set and toggled within the interactive shell itself. The full option name does not need to be used; only enough letters to make the option unique must be specified.

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 will print general help, and the !variables command will print all of the current variable settings. The !file command will read input from a file. The !file command is not a variable; it cannot be set. It can be used repeatedly.

The !exit command will cause link-parser to exit.

The dictionary entry for any given word (optionally terminated by a subscript) may be examined by preceding it with two exclamation marks. A wildcard character '*' can be specified as the last character of the word in order to find multiple matches. Default values of the options below are shown in parenthesis. Most of them are the default ones of the link-grammar library. Boolean default values are shown as on (1) or off (0).

-bad (off)
    Enable display of bad linkages.

-batch (off)
    Enable batch mode.

-cluster (off)
    Use clusters to loosen parsing.

-constituents (0)
    Generate constituent output. Its value may be:

    0   Disabled

    1   Treebank-style constituent tree

    2   Flat, bracketed tree [A like [B this B] A]

    3   Flat, treebank-style tree (A like (B this))

-cost-max (2.7)
    Largest cost to be considered.

-disjuncts (off)
    Display of disjuncts used.

-echo (off)
    Echo input sentence.

-graphics (on)
    Enable graphical display of linkage. For each linkage, the sentence is printed along with a graphical representation of its linkage above it.

    The following notations are used for words in the sentence:

    [word]
        A word with no linkage.

    word[?].x
        An unknown word whose POS category x has been found by the parser.

    word[!]
        An unknown word whose link-grammar dictionary entry has been assigned by a RegEx. (Use !morphology=1 to see the said dictionary entry.)

    word[~]
        There was an unknown word in this position, and it has got replaced, using a spell guess with this word, that is found in the link-grammar dictionary.

    word[&]
        This word is a part of an unknown word which has been found to consist of two or more words that are in the link-grammar dictionary.

-islands-ok (on)
    Use null-linked islands.

-limit (1000)
    Limit the maximum linkages processed.

-links (off)
    Enable display of complete link data.

-null (on)
    Allow null links.

-morphology (off)
    Display word morphology. When a word matches a RegEx, show the matching dictionary entry.

-panic (on)
    Use "panic mode" if a parse cannot be quickly found.

-postscript (off)
    Generate postscript output.

-senses (off)
    Display word senses.

-short (16)
    Maximum length of short links.

-spell (7)
    If zero, no spell and run-on corrections of unknown words are performed.
    Else, use up to this many spell-guesses per unknown word. In that case, the number of run-on corrections (word split) of unknown words is not limited.

-timeout (30)
    Abort parsing after this many seconds.

-use-sat (off)
    Use Boolean SAT-based parser.

-verbosity (1)
    Level of detail in output.

-walls (off)
    Display wall words.

-width (16381)(*)
    The width of the display.
    * When writing to a terminal, this value is set from its width.

FILES
The following files are per-language, when LL is the 2-letter ISO language code.

LL/4.0.dict
    The Link Grammar dictionary.

LL/4.0.affix
    Values of entities used in tokenization.

LL/4.0.regex
    Regular expressions (see regex(7)) that are used to match tokens not found in the dictionary.

LL/4.0.knowledge
    Post-processing definitions.

LL/4.0.constituent-knowledge
    Definitions for producing a constituent tree.

The directory search order for these files is:
    ./
    data/
    ../
    ../data/
    A custom path, as set by the API call dictionary_set_data_dir().
    /usr/share/link-grammar/

SEE ALSO
Information on the link-grammar shared-library API and the link types used in the parse is available at the AbiWord website (http://www.abisource.com/projects/link-grammar/).

Peer-reviewed papers explaining Link Grammar can be found at original CMU site (http://www.link.cs.cmu.edu/link/papers).

The source code of link-parser and the link-grammar library is located at GitHub (https://github.com/opencog/link-grammar).

The mailing list for Link Grammar discussion is at link-grammar Google group (http://groups.google.com/group/link-grammar?hl=en).

AUTHOR
link-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>.