On 2016-02-12 14:16:50 +0000, Nicola said:
> Another possibility is to download an .oxt file, change the suffix to
> .zip, uncompress it, and open the thesaurus .dat file (it is a text
> file). I have taken a quick look at one of them, and it should not be
> too hard to turn it into a format usable by Vim: removing the first
> line and the parts in parentheses should be enough.
Mmh, not so fast. Each entry in a .dat file has this form:
abbreviate|2
(verb)|reduce (generic term)
(verb)|abridge|foreshorten|shorten|cut|contract|reduce|...
You need to put each entry on a single line that looks like this:
abbreviate|reduce|abridge|foreshorten|...
This may be done, for example, with awk:
awk '/\|[0-9]+$/{if (NR!=1) print "";sub(/\|[0-9]+$/,"");printf
$0;next}{printf "|"$0}END{print "";}' th_en_US_v2.dat >th_en_US_v2.txt
(This command is a single line.)
Then, you may remove the spurious parts, like (verb) or (generic term).
That may be done by editing the thesaurus in Vim:
:%s/([^)]\+)//g
There are some other adjustments to be done, like || to be replaced
by |, and some spaces to be removed.
But, there is an inherent limitation in Vim (as far as I know). If you
ask for suggestions in LibreOffice/OpenOffice for 'abbreviate', you'll
get the list above. Vim, instead, will show you *all* the words in
*all* the lines in the thesaurus containing 'abbreviate'. So, for
example, since the thesaurus also contains:
bowdlerise|1
(verb)|bowdlerize|expurgate|...|abbreviate (generic term)|...
you'll get 'bowdlerise', too.
I wish there were an option to tell Vim to offer only the suggestions
in those lines of a thesaurus that *start* with a given word.
Nicola
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Friday, February 12, 2016
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment