1LINK-PARSER(1)              General Commands Manual             LINK-PARSER(1)
2
3
4

NAME

6       link-parser - parse natural language sentences using Link Grammar
7

SYNOPSIS

9       link-parser --help
10       link-parser --version
11       link-parser [language|dict_location] [--quiet] [-<special_"!"_command>...]
12

DESCRIPTION

14       link-parser  is  the  command-line  wrapper to the link-grammar natural
15       language parsing library.  This library will parse sentences written in
16       English,  Russian and other languages, generating linkage trees showing
17       relationships between the subject, the verb,  and  various  adjectives,
18       adverbs, etc. in the sentence.
19

EXAMPLE

21       link-parser
22
23       Starts the parser interactive shell.  Enter any sentence to parse:
24
25       linkparser> Reading a man page is informative.
26
27       Found 18 linkages (18 had no P.P. violations)
28               Linkage 1, cost vector = (UNUSED=0 DIS= 0.00 LEN=16)
29
30           +------------------------Xp------------------------+
31           +--------------->WV-------------->+                |
32           |         +----------Ss*g---------+                |
33           |         +--------Os-------+     |                |
34           |         |     +---Ds**x---+     |                |
35           +--->Wd---+     +-PHc+---A--+     +---Pa---+       |
36           |         |     |    |      |     |        |       |
37       LEFT-WALL reading.g a man.ij page.n is.v informative.a .
38

BACKGROUND

40       The link-parser command-line tool is useful for general exploration and
41       use, although it is presumed that, for the parsing of large  quantities
42       of  text, a custom application, making use of the link-grammar library,
43       will be written.  Several such applications are described on  the  Link
44       Grammar  web page (see SEE ALSO below); these include the AbiWord gram‐
45       mar checker, and the RelEx semantic relation extractor.
46
47       The theory of Link Grammar is explained in many  academic  papers.   In
48       the first of these, Daniel Sleator and Davy Temperley, "Parsing English
49       with a Link Grammar" (1991), the authors defined a new formal grammati‐
50       cal  system called a "link grammar". A sequence of words is in the lan‐
51       guage of a link grammar if there is a way to draw "links" between words
52       in  such  a way that the local requirements of each word are satisfied,
53       the links do not cross, and  the  words  form  a  consistent  connected
54       graph.  The  authors  encoded  English  grammar into such a system, and
55       wrote link-parser to parse English using this grammar.
56
57       The engine that performs the parsing is separate from the  dictionaries
58       describing  a  language.  Currently, the most fully developed, complete
59       dictionaries are for the English and Russian languages, although exper‐
60       imental,  incomplete dictionaries exist for German and eight other lan‐
61       guages.
62
63

OVERVIEW

65       link-parser, when invoked manually, starts an interactive shell, taking
66       control  of the terminal.  Any lines beginning with an exclamation mark
67       are assumed to be a "special command"; these are described below.   The
68       command !help will provide more info; the command !variables will print
69       all of the special commands.  These are also called "variables", as al‐
70       most  all commands have a value associated with them: the command typi‐
71       cally enable or disable some function, or they alter some  multi-valued
72       setting.
73
74       All  other  input is treated as a single, English-language sentence; it
75       is parsed, and the result of the parse is printed.  The variables  con‐
76       trol  what  is  printed:   By  default,  an  ASCII-graphics  linkage is
77       printed, although post-script output is also possible.  The printing of
78       the constituent tree can also be enabled. Other output controls include
79       the printing of disjuncts and complete link data.
80
81       In order to analyze sentences, link-parser depends  on  a  link-grammar
82       dictionary.  This contains lists of words and associated metadata about
83       their grammatical properties.  An English language dictionary  is  pro‐
84       vided  by default.  If other language dictionaries are installed in the
85       default search locations, these may be explicitly specified by means of
86       a 2-letter ISO language code: so, for example:
87
88           link-parser de
89
90       will start the parser shell with the German dictionary.
91
92       Alternately,  the  dictionary location can be specified explicitly with
93       either an absolute or a relative file path; so, for example:
94
95           link-parser /usr/share/link-grammar/en
96
97       will run link-parser using the English dictionary located in the  typi‐
98       cal install directory.
99
100       link-parser  can  also be used in a non-interactive mode ("batch mode")
101       via the -batch option (a special command, see below): So, for example:
102
103           cat thesis.txt | link-parser -batch
104
105       will read lines from the file thesis.txt, processing each one as a com‐
106       plete  sentence.  For  sentences  that don't have a full parse, it will
107       print
108       +++++ error N
109       (N is a number) to the standard output.
110
111       Alternately, an input file may be specified  with  the  !file  filename
112       special command, described below.
113
114       Note  that using "batch mode" disables the usual ASCII-graphics linkage
115       printing. The input sentences also don't appear by default  on  stdout.
116       These features may be re-enabled via special commands; special commands
117       may be interspersed with the input.
118
119       Instead of specifying -batch in the command-line, !batch can be  speci‐
120       fied in the said input file.
121
122       For more details, use !help batch in link-parser's interactive shell.
123
124

OPTIONS

126       --help Print usage and exit.
127
128       --version
129              Print program version and configuration details, and exit.
130
131       --quiet
132              Suppress the version messages on startup.
133
134
135   Special ! commands
136       The  special  "!"  commands can be specified as command-line options in
137       the command-line, or within the interactive shell itself  by  prefixing
138       them  with "!" on line start.  The full option name does not need to be
139       used; only enough letters to make the option unique must be specified.
140
141       When specifying as a command-line option, a  special  command  is  pro‐
142       ceeded by "-" instead of "!".
143
144       Boolean variables may be toggled simply by giving the !varname, for ex‐
145       ample, !batch.  Setting other variables require using an  equals  sign:
146       !varname=value, for example, !width=100.
147
148       The !help command prints general help. When issued from the interactive
149       shell, it  can  get  an  argument,  usually  a  special  command.   The
150       !variables  command  prints  all of the current variable settings.  The
151       !file command reads input from its argument file.  The !file command is
152       not a variable; it cannot be set.  It can be used repeatedly.
153
154       The !exit command instructs link-parser to exit.
155
156       The  exclamation  mark "!" is also a special command by itself, used to
157       inspect the dictionary entry for any given word (optionally  terminated
158       by  a  subscript).  Thus two exclamation marks are needed before such a
159       word when doing so from the interactive shell. The  wildcard  character
160       "*" can be specified as the last character of the word in order to find
161       multiple matches.
162
163       Default values of the special commands below are shown in  parenthesis.
164       Most of them are the default ones of the link-grammar library.
165       Boolean default values are shown as on (1) or off (0).
166
167
168       !bad (off)
169              Enable display of bad linkages.
170
171       !batch (off)
172              Enable batch mode.
173
174       !constituents (0)
175              Generate constituent output. Its value may be:
176
177              0      Disabled
178
179              1      Treebank-style constituent tree
180
181              2      Flat, bracketed tree [A like [B this B] A]
182
183              3      Flat, treebank-style tree (A like (B this))
184
185       !cost-max (2.7)
186              Largest cost to be considered.
187
188       !dialect (no value)
189              Use the specified (comma-separated) names.
190              They  modify the disjunct cost of dictionary words whose expres‐
191              sions contain symbolic cost specifications.
192
193       !disjuncts (off)
194              Display of disjuncts used.
195
196       !echo (off)
197              Echo input sentence.
198
199       !graphics (on)
200              Enable graphical display of linkage.  For each linkage, the sen‐
201              tence  is  printed  along with a graphical representation of its
202              linkage above it.
203
204              The following notations are used for words in the sentence:
205
206              [word] A word with no linkage.
207
208              word[?].x
209                     An unknown word whose POS category x has  been  found  by
210                     the parser.
211
212              word[!]
213                     An  unknown  word whose link-grammar dictionary entry has
214                     been assigned by a RegEx.  (Use !morphology=1 to see  the
215                     said dictionary entry.)
216
217              word[~]
218                     There  was  an  unknown word in this position, and it has
219                     got replaced, using a spell guess with this word, that is
220                     found in the link-grammar dictionary.
221
222              word[&]
223                     This  word  is  a  part of an unknown word which has been
224                     found to consist of two or more words  that  are  in  the
225                     link-grammar dictionary.
226
227              word.POS
228                     This word found in the dictionary as word.POS.
229
230              word.#CORRECTION
231                     This  word is probably a typo - got linked as an alterna‐
232                     tive word CORRECTION.
233
234              For dictionaries that support morphology (enable with  !morphol‐
235              ogy=1):
236
237              word=  A prefix morpheme
238
239              =word  A suffix morpheme
240
241              word.= A stem
242
243       !islands-ok (on)
244              Use null-linked islands.
245
246       !limit (1000)
247              Limit the maximum linkages processed.
248
249       !links (off)
250              Enable display of complete link data.
251
252       !null (on)
253              Allow null links.
254
255       !morphology (off)
256              Display  word morphology.  When a word matches a RegEx, show the
257              matching dictionary entry.
258
259       !panic (on)
260              Use "panic mode" if a parse cannot be quickly found.
261              The command !panic_variables prints the special  variables  that
262              are used only in "panic mode".
263
264       !postscript (off)
265              Generate postscript output.
266
267       !short (16)
268              Maximum length of short links.
269
270       !spell (7)
271              If  zero,  no  spell and run-on corrections of unknown words are
272              performed.
273              Else, use up to this many spell-guesses  per  unknown  word.  In
274              that  case, the number of run-on corrections (word split) of un‐
275              known words is not limited.
276
277       !timeout (30)
278              Abort parsing after this many seconds.
279
280       !use-sat (off)
281              Use Boolean SAT-based parser.
282
283       !verbosity (1)
284              Level of detail in output. Some useful values:
285
286              0      No prompt, minimal library messages
287
288              1      Normal verbosity
289
290              2      Show times of the parsing steps
291
292              3      Display some more information messages
293
294              4      Display data file search and locale setup
295
296              5-9    Tokenizer and parser debugging
297
298              10-19  Dictionary debugging
299
300              101    Print all the dictionary  connectors,  along  with  their
301                     length limit
302
303
304       !walls (off)
305              Display wall words.
306
307       !width (16381)(*)
308              The width of the display.
309              * When writing to a terminal, this value is set from its width.
310
311       !wordgraph (0)
312              Display the wordgraph (word-split graph).
313
314              0      Disabled
315
316              1      Default display
317
318              2      Display parent tokens as subgraphs
319
320              3      Use esoteric display flags as set by !test=wg:FLAGS
321
322

FILES

324       The  following files are per-language, when LL is the 2-letter ISO lan‐
325       guage code.
326
327       LL/4.0.dict
328              The Link Grammar dictionary.
329
330       LL/4.0.affix
331              Values of entities used in tokenization.
332
333       LL/4.0.regex
334              Regular expressions (see regex(7)) that are used to match tokens
335              not found in the dictionary.
336
337       LL/4.0.dialect
338              Dialect component definitions.
339
340       LL/4.0.knowledge
341              Post-processing definitions.
342
343       LL/4.0.constituent-knowledge
344              Definitions for producing a constituent tree.
345
346       command-help-LL.txt or command-help-LL-CC.txt
347              Help  text  for the !help topic special "!" command.  If several
348              such files are provided, the desired one can be selected by e.g.
349              the  LANGUAGE  environment  variable if it is set to LL or LL-CC
350              (default is en). Currently only command-help-en.txt is provided.
351
352
353
354       The directory search order for these files is:
355./
356data/
357../
358../data/
359              •   A  custom  data  directory,  as  set   by   the   API   call
360              dictionary_set_data_dir().
361              •  Installation-depended system data directory (*)
362
363
364              *   This  location  is  displayed  as  DICTIONARY_DIR  when  the
365              --version argument is provided to  link-parser  on  the  command
366              line.   On  windows  it  may  be relative to the location of the
367              link-grammar library DLL; in that case the  actual  location  is
368              displayed as "System data directory" when link-parser is invoked
369              with -verbosity=4.
370
371

SEE ALSO

373       Information on the link-grammar shared-library API and the  link  types
374       used   in   the   parse   is   available   at   the   AbiWord   website
375http://www.abisource.com/projects/link-grammar/⟩.
376
377       Peer-reviewed papers explaining Link Grammar can be found  at  original
378       CMU site ⟨http://www.link.cs.cmu.edu/link/papers⟩.
379
380       The  source code of link-parser and the link-grammar library is located
381       at GitHub ⟨https://github.com/opencog/link-grammar⟩.
382
383       The mailing list for Link Grammar discussion is at link-grammar  Google
384       group ⟨http://groups.google.com/group/link-grammar?hl=en⟩.
385

AUTHOR

387       link-parser and the link-grammar library were written by Daniel Sleator
388       <sleator@cs.cmu.edu>, Davy Temperley  <dtemp@theory.esm.rochester.edu>,
389       and John Lafferty <lafferty@cs.cmu.edu>
390
391       This  manual  page was written by Ken Bloom <kbloom@gmail.com>, for the
392       Debian project, and updated by Linas Vepstas <linasvepstas@gmail.com>.
393
394
395
396Version 5.9.0                     2021-03-30                    LINK-PARSER(1)
Impressum