Link-Grammar Wordlist output to a (txt) file.. possible future feature

38 views
Skip to first unread message

Dennis Grubb

unread,
Dec 11, 2021, 6:24:43 PM12/11/21
to link-grammar
Is it possible to output the (or a) dictionary wordlist to a text file, probably just the word and its type, with comma separators so it can be imported into a spreadsheet.
I note that it can be sent to the console screen with the "!!*" command, so redirection and filtering should not be too difficult.
Easier then to note omissions, and more.
I guess this functionality should sit in dict-api
Dennis

ami...@gmail.com

unread,
Dec 12, 2021, 11:35:09 AM12/12/21
to link-grammar
Hi Dennis,

Instead of the !!* command at the "linkparser>" prompt, you can use the -!* argument of link-parser.
Here is how to do it on Windows:
 
First produce a word list (one per line) by the following cmd console command:
(for /f  %a in ('link-parser -!* ^< nul ^| findstr /c:"disjuncts <"') do @echo %a) > wordlist.out

The words are output as e.g. test.n and if you would like to separate the "type" (called the word "subscript") with a comma instead of dot then you will need to process this list further, possibly by using PowerShell regex. (You need to replace the last dot with a comma, not just any dot because some words are abbreviations that include dots.)

Amir

Dennis Grubb

unread,
Dec 13, 2021, 2:00:06 AM12/13/21
to link-g...@googlegroups.com
Thanks Amir,
I will try your solution.
Where is the documentation regarding console command arguments for link-parser ?
Would it be particularly difficult to add into dict-api ?
Dennis




--
You received this message because you are subscribed to the Google Groups "link-grammar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to link-grammar...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/link-grammar/438799b3-6d6f-4a7f-8b1b-a8a38e79a1a1n%40googlegroups.com.

ami...@gmail.com

unread,
Dec 13, 2021, 8:28:33 PM12/13/21
to link-grammar
On Monday, 13 December 2021 at 09:00:06 UTC+2 dennis....@gmail.com wrote:
Thanks Amir,
I will try your solution.
Where is the documentation regarding console command arguments for link-parser ?

It is in the file "man/link-parser.1".  However, it is not so readable on Windows.
You can read it on the Web by googling:
man link-parser 5.9.0
(The last version of this file is from LG version 5.9.0.)

You will find out that almost all the arguments are in the form -X when X is a link-parser variable or "!".

Would it be particularly difficult to add into dict-api ?

There is not much point in doing so since it can easily be done by manipulating the output of -!* .
However, you can add a function similar to print_dictionary_data() to the API, or even easier, change it to print the dictionary words in any format you desire when link-parser is invoked with e.g. -verbosity=105 (so no need to add anything to the list of API functions).

Dennis

Amir

Dennis Grubb

unread,
Dec 21, 2021, 5:41:23 PM12/21/21
to link-grammar
Thanks Amir,
great solution for me.. and I now understand the -!* argument
Much appreciated help.

ami...@gmail.com

unread,
Dec 27, 2021, 6:08:23 AM12/27/21
to link-grammar
Hi Dennis,
In case you have not seen it yet, thecommand also has some esoteric options that you may find interesting.
You can see its documentation using the !help command of link-parser:
linkparser> !help !
(The help file is data/en/command-help-en.txt so you can also read it directly.)

Amir

Dennis Grubb

unread,
Dec 27, 2021, 3:23:16 PM12/27/21
to link-g...@googlegroups.com
Thanks Amir, I will take a look. 
Dennis

Sent from my iPhone

On 27 Dec 2021, at 22:08, ami...@gmail.com <ami...@gmail.com> wrote:

Hi Dennis,
--
You received this message because you are subscribed to a topic in the Google Groups "link-grammar" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/link-grammar/kga1ExIVrvE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to link-grammar...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/link-grammar/1a22d17f-db19-4327-ad33-c1d931b116dcn%40googlegroups.com.

ami...@gmail.com

unread,
Jan 13, 2022, 9:47:19 AM1/13/22
to link-grammar
In a private mail, Dennis pointed out that the command I provided below doesn't list many words.
And indeed the filter I applied in it is too strict.
Here is the fixed command (for clarity I added a blank between " and ' , and also note the two blanks before "disjunct"):
(for /f  %a in ('link-parser -!* ^< nul ^| findstr/r /c:"[0-9]  disjunct" ') do @echo %a) > wordlist.out

Amir
Reply all
Reply to author
Forward
0 new messages