1LINK-PARSER(1) General Commands Manual LINK-PARSER(1)
2
3
4
6 link-parser - parse natural language sentences using Link Grammar
7
9 link-parser --help
10 link-parser --version
11 link-parser [language|dict_location] [--quiet] [-<special_"!"_command>...]
12
14 link-parser is the command-line wrapper to the link-grammar natural
15 language parsing library. This library will parse English language
16 sentences, generating linkage trees showing relationships between the
17 subject, the verb, and various adjectives, adverbs, etc. in the sen‐
18 tence.
19
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
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 several other
61 languages.
62
63
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
70 almost all commands have a value associated with them: the command typ‐
71 ically 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
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
145 example, !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 !disjuncts (off)
189 Display of disjuncts used.
190
191 !echo (off)
192 Echo input sentence.
193
194 !graphics (on)
195 Enable graphical display of linkage. For each linkage, the sen‐
196 tence is printed along with a graphical representation of its
197 linkage above it.
198
199 The following notations are used for words in the sentence:
200
201 [word] A word with no linkage.
202
203 word[?].x
204 An unknown word whose POS category x has been found by
205 the parser.
206
207 word[!]
208 An unknown word whose link-grammar dictionary entry has
209 been assigned by a RegEx. (Use !morphology=1 to see the
210 said dictionary entry.)
211
212 word[~]
213 There was an unknown word in this position, and it has
214 got replaced, using a spell guess with this word, that is
215 found in the link-grammar dictionary.
216
217 word[&]
218 This word is a part of an unknown word which has been
219 found to consist of two or more words that are in the
220 link-grammar dictionary.
221
222 word.POS
223 This word found in the dictionary as word.POS.
224
225 word.#CORRECTION
226 This word is probably a typo - got linked as an alterna‐
227 tive word CORRECTION.
228
229 !islands-ok (on)
230 Use null-linked islands.
231
232 !limit (1000)
233 Limit the maximum linkages processed.
234
235 !links (off)
236 Enable display of complete link data.
237
238 !null (on)
239 Allow null links.
240
241 !morphology (off)
242 Display word morphology. When a word matches a RegEx, show the
243 matching dictionary entry.
244
245 !panic (on)
246 Use "panic mode" if a parse cannot be quickly found.
247
248 !postscript (off)
249 Generate postscript output.
250
251 !short (16)
252 Maximum length of short links.
253
254 !spell (7)
255 If zero, no spell and run-on corrections of unknown words are
256 performed.
257 Else, use up to this many spell-guesses per unknown word. In
258 that case, the number of run-on corrections (word split) of
259 unknown words is not limited.
260
261 !timeout (30)
262 Abort parsing after this many seconds.
263
264 !use-sat (off)
265 Use Boolean SAT-based parser.
266
267 !verbosity (1)
268 Level of detail in output. Some useful values:
269
270 0 No prompt, minimal library messages
271
272 1 Normal verbosity
273
274 2 Show times of the parsing steps
275
276 3 Display data file search and locale setup
277
278 5-9 Tokenizer and parser debugging
279
280 10-19 Dictionary debugging
281
282 101 Print all the dictionary connectors, along with their
283 length limit
284
285
286 !walls (off)
287 Display wall words.
288
289 !width (16381)(*)
290 The width of the display.
291 * When writing to a terminal, this value is set from its width.
292
293 !wordgraph (0)
294 Display the wordgraph (word-split graph).
295
296 0 Disabled
297
298 1 Default display
299
300 2 Display parent tokens as subgraphs
301
302 3 Use esoteric display flags as set by !test=wg:FLAGS
303
304
306 The following files are per-language, when LL is the 2-letter ISO lan‐
307 guage code.
308
309 LL/4.0.dict
310 The Link Grammar dictionary.
311
312 LL/4.0.affix
313 Values of entities used in tokenization.
314
315 LL/4.0.regex
316 Regular expressions (see regex(7)) that are used to match tokens
317 not found in the dictionary.
318
319 LL/4.0.knowledge
320 Post-processing definitions.
321
322 LL/4.0.constituent-knowledge
323 Definitions for producing a constituent tree.
324
325 command-help-LL.txt or command-help-LL-CC.txt
326 Help text for the !help topic special "!" command. If several
327 such files are provided, the desired one can be selected by e.g.
328 the LANGUAGE environment variable if it is set to LL or LL-CC
329 (default is en). Currently only command-help-en.txt is provided.
330
331
332
333 The directory search order for these files is:
334 · ./
335 · data/
336 · ../
337 · ../data/
338 · A custom data directory, as set by the API call
339 dictionary_set_data_dir().
340 · Installation-depended system data directory (*)
341
342
343 * This location is displayed as DICTIONARY_DIR when the
344 --version argument is provided to link-parser on the command
345 line. On windows it may be relative to the location of the
346 link-grammar library DLL; in that case the actual location is
347 displayed as "System data directory" when link-parser is invoked
348 with -verbosity=4.
349
350
352 Information on the link-grammar shared-library API and the link types
353 used in the parse is available at the AbiWord website
354 ⟨http://www.abisource.com/projects/link-grammar/⟩.
355
356 Peer-reviewed papers explaining Link Grammar can be found at original
357 CMU site ⟨http://www.link.cs.cmu.edu/link/papers⟩.
358
359 The source code of link-parser and the link-grammar library is located
360 at GitHub ⟨https://github.com/opencog/link-grammar⟩.
361
362 The mailing list for Link Grammar discussion is at link-grammar Google
363 group ⟨http://groups.google.com/group/link-grammar?hl=en⟩.
364
366 link-parser and the link-grammar library were written by Daniel Sleator
367 <sleator@cs.cmu.edu>, Davy Temperley <dtemp@theory.esm.rochester.edu>,
368 and John Lafferty <lafferty@cs.cmu.edu>
369
370 This manual page was written by Ken Bloom <kbloom@gmail.com>, for the
371 Debian project, and updated by Linas Vepstas <linasvepstas@gmail.com>.
372
373
374
375Version 5.5.2 2018-09-28 LINK-PARSER(1)