LibreOffice plugin to pipe whole Writer documents through Google Translate, that ought to keep most of the page formatting.

⌈⌋ branch:  PageTranslate


Check-in [5894146f61]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:added related/subproject: dingonyms
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5894146f6138ef2ee32c54e2ebd5440b29a11da0
User & Date: mario 2021-02-27 13:41:16
Context
2021-02-27
17:47
dingonyms: add --reverso and language params, and --nh, --no-antonyms options. check-in: a48bf46e7e user: mario tags: trunk
13:41
added related/subproject: dingonyms check-in: 5894146f61 user: mario tags: trunk
2021-02-10
16:36
overwrite self.params["from"] on each init (becasue it's a class property) check-in: 5c19793b64 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added dingonyms/Makefile.

















>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
#!/usr/bin/make

whl:
	./setup.py bdist_wheel
%.1:	%.md
	pandoc --standalone -f markdown+pandoc_title_block+grid_tables -t man $< -o $@
man:	man/dingonyms.1

Added dingonyms/dingonyms.py.











































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
#!/usr/bin/env python3
# encoding: utf-8
# api: cli
# type: filter
# title: dingonyms
# description: scrape synonyms from various web services
# version: 0.3
# license: PD
# category: dictionary
# keywords: glossary, synonyms, antonyms
# classifiers: search, dict
# architecture: all
# depends: deb:ding (>= 1.8), python (>= 3.7), python:requests (>= 2.1)
#
#
# CLI tool to extract synonyms/antonyms from online services, which formats
# them into dict structures (word|alt :: definition; etc.) suitable for `ding`.
#
# It's fairly basic, and not all result sets are structured alike.
# Furthermore the extraction schemes aren't likely to last for long; web
# scraping is typically a maintenance task.
# Only scans for singular words (most services wouldn't return results
# otherwise). And might spit out error messages for charset issues as well.
#
# SYNTAX
#
#    dingonyms --thesaurus "Define"
#    dingonyms --merriamwebster "find"
#    dingonyms --synonym "Wort"
#    dingonyms --urban "bazinga"
#    dingonyms --openthesaurus "Wort"
#    dingonyms --woxikon "Wort"
#
# Flags can be abbreviated and also combined: --thes --merrweb would query two
# services at once, or --all even all. While --en or --de run through language-
# specific functions.
# Reason for supporting multiple sites is allowing to fall back on others if
# one extraction method breaks.
#
# CONFIG IN ~/.dingrc (take care to change `3` to available index)
#
#    set searchmeth(3,name) {Synonyms}
#    set searchmeth(3,type) {3}
#    set searchmeth(3,dictfile) {}
#    set searchmeth(3,separator) { :: }
#    set searchmeth(3,language1) {Group}
#    set searchmeth(3,language2) {Synonyms}
#    set searchmeth(3,grepcmd) {dingonyms}
#    set searchmeth(3,grepopts) {--thesaurus}
#    set searchmeth(3,maxlength) {30}
#    set searchmeth(3,maxresults) {200}
#    set searchmeth(3,minlength) {2}
#    set searchmeth(3,shapedresult) {1}
#    set searchmeth(3,foldedresult) {0}
#
# You might want to add one entry for each search backend even.
# (Unique index, title/name, and grepopts --parameter each.)
#
# SETUP (pip3 install -U dingonyms)
#
# You might have to symlink ~/.local/bin/dingonyms into ~/bin after
# installation. pip-package binaries are often only picked up in
# terminal/interactive shells.
#



import sys, os, re
import requests, json, html, textwrap
try:
    sys.stdout.reconfigure(encoding="utf-8")
except:
    pass# and pray


def http_get(url):
    """ fetch page per requests GET, add user-agent header """
    return requests.get(
        url,
        headers={"User-Agent":"dingonyms/0.2 (Python 3.x; Linux; CLI/ding; +https://pypi.org/projects/dingonyms)"}
    ).text


class out:
    """ output utility functions """
    
    @staticmethod
    def fold(other):
        """ Wrap list of words acrosss multiple lines, conjoin ~45 chracters of words in each """
        rows = []
        line = []
        for w in other:
            if len("; ".join(line + [w])) > 45:
                rows.append("; ".join(line))
                line = []
            line.append(w)
        if line:
            rows.append("; ".join(line))
        return rows
    
    @staticmethod
    def alternatives(word, other, fold=True):
        """ craft `Word :: Synonyms` lines """
        if fold:
            other = out.fold(other)
        pipes = len(other) - len(word.split("|"))
        word = word + (" |" * pipes)
        print("{} :: {}".format(word, " | ".join(other)))

    @staticmethod
    def site(name):
        """ output prefix for online service """
        print("✎ {%s}" % name)

    @staticmethod
    def group(name="Antonyms"):
        """ section prefix """
        print("❙ {%s} ❙" % name)

    @staticmethod
    def unhtml(text):
        """ crude html2text for urbandictionary flow text """
        text = re.sub("\s+", " ", text)
        text = re.sub("<br>|</div>", "\n", text, re.I)
        text = re.sub("(<[^<]+(>|$))+", " ", text)
        return re.sub("  +", " ", html.unescape(text))

        
class lookup:
    """
        Online service backends and extraction.
        Not a real object, just a function collection.
    """

    def thesaurus_raw(self, word, html=""):
        """ thesaurus-?(raw|htm) """
        if not html:
            html = http_get("https://www.thesaurus.com/browse/%s" % word)
        other = []
        grp = "synonym"
        # look for word links, or grouping divs (not many reliable html structures or legible class names etc.)
        for row in re.findall(' "/browse/([\w.-]+)" | <div\s+id="(meanings|synonyms|antonyms|[a-z]+)" | (</html)', html, re.X):
            if row[0]:
                other.append(row[0])
            else:
                if other:
                    out.alternatives("%s {%s}" % (word, grp), other)
                    other = []
                grp = row[1]

    def thesaurus(self, word):
        """ thesauru s |t | t[he]+s[saurus]* """
        out.site("Thesaurus.com")
        html = http_get("https://www.thesaurus.com/browse/%s" % word)
        # there's a nice pretty JSON blob inside the page
        m = re.search("INITIAL_STATE\s*=\s*(\{.+\})[;<]", html)
        if m:
            j = json.loads(re.sub('"\w+":undefined,', '', m.group(1)))
            for grp in "synonyms", "antonyms":
                if grp == "antonyms":
                    out.group("Antonyms")
                for d in j["searchData"]["relatedWordsApiData"]["data"]:
                    if grp in d and len(d[grp]):
                        out.alternatives(
                            "%s {%s} (%s)" % (d["entry"], d["pos"], d["definition"]),
                            [word["term"] for word in d[grp]]
                        )
        else:
            self.thesaurus_raw(word, html)

    def openthesaurus(self, word):
        """ openthesaurus | open | ot | opnt\w+ """
        out.site("OpenThesaurus.de")
        # there's a proper API here
        j = json.loads(http_get("https://www.openthesaurus.de/synonyme/search?q=%s&format=application/json&supersynsets=true" % word))
        for terms in j["synsets"]:
            supersyn = ""
            if terms["supersynsets"] and terms["supersynsets"][0]:
                supersyn = "; ".join([w["term"] for w in terms["supersynsets"][0]][0:3])
                supersyn = "("+supersyn+")"
            out.alternatives(
                "%s %s" % (word, supersyn),
                [w["term"] for w in terms["terms"]]
            )
            
    def woxikon(self, word):
        """ woxikon | w | wx | wxk\w* """
        out.site("Woxikon")
        html = http_get("https://synonyme.woxikon.de/synonyme/%s.php" % word.lower())
        grp = ""
        ls = []
        for row in re.findall(' <a\s+href="[^"]+/synonyme/[\w.%-]+">(\w[^<]+)</a> | Bedeutung:\s+<b>(\w[^<]+)< | </html ', html, re.X):
            if row[0]:
                ls.append(row[0])
            else:
                if ls:
                    out.alternatives("%s (%s)" % (word, grp), ls)
                    ls = []
                grp = row[1]

    def merriamwebster(self, word):
        """ merriam-?webster | mw | mer\w* | m\w*w\*b\w* | \w*web\*w """
        out.site("Merriam-Webster")
        html = http_get("https://www.merriam-webster.com/thesaurus/%s" % word)
        grp = "Synonyms"
        ls = []
        # word links here are decorated with types (noun/verb), and groups neatly include a reference to the search term (or possibly a different related term)
        for row in re.findall(' href="/thesaurus/([\w.-]+)\#(\w+)" | ="function-label">(?:Words\s)?(Related|Near\sAntonyms|Antonyms|Synonyms|\w+)\s\w+\s<em>([\w.-]+)</em> | (</html)', html, re.X):
            #print(row)
            if row[0]:
                ls.append("%s {%s}" % (row[0], row[1][0]))
            else:
                if ls:
                    out.alternatives(word + " {%s}" % grp, ls)
                    ls = []
                grp = row[2]
                word = row[3]

    #def reverso(self, word):
    #https://synonyms.reverso.net/synonym/de/word

    def synonym(self, word):
        """
            synonym(\.?com) | s | sy?n\w* |
            
            Doing a fair bit of super-specific HTML lookarounds here, because
            there's a wealth of decoration. DOM traversal might have been simpler
            in this case.
        """
        out.site("synonym.com")
        html = http_get("https://www.synonym.com/synonyms/%s" % word)
        html = re.sub('^.+?="result-group-container">', "", html, 0, re.S)
        html = re.sub('<div class="rightrail-container">.+$', "", html, 0, re.S)
        ...
        rx = """
            <div\sclass="word-title.+?> \s*\d\.\s ([\w.\-]+) \s* 
               \s* .*?
               \s* <span\s+class="part-of-speech">\s*(\w+)[.\s]*</span>
               \s* <span\s+class="pronunciation">\((.+?)\)</span>
               \s* <span\s+class="definition"> (.+?) </div> |
            <a\sclass="chip[^">]*"\shref="/synonyms/([\w.-]+)" |
            <div\sclass="card-title[^>]+>\s*(Antonyms)\s*</div> |
            </html>
        """
        ls = []
        for group, verb, pron, defs, add_word, antonyms in re.findall(rx, html, re.X|re.S):
            if add_word:
                ls.append(add_word)
            else:
                if ls:
                    out.alternatives(word, ls)
                    ls = []
                if antonyms:
                    word = " 🞬 {Antonyms}"
                    continue
                    #if not ls:
                    #    continue
                defs = re.sub('(<[^>]+>|\s+)+', " ", defs, 0, re.S).strip()
                defs = " |   ".join(textwrap.wrap(defs, 50))
                word = group + " {" + verb + "} [" + pron + "] |  (" + defs + ")"

                
    def urban(self, word):
        """ urban | u | u\w*[brn]\w* """
        out.site("UrbanDictionary")
        html = http_get("https://www.urbandictionary.com/define.php?term=%s" % word)
        for html in re.findall('="def-panel\s*"[^>]*>(.+?)="contributor|def-footer">', html, re.S):
            if re.search('<div class="ribbon">[\w\s]+ Word of the Day</div>', html):
                continue
            else:
                html = re.sub('^.+?="def-header">', "", html, 1, re.S)
            m = re.search('<a class="word" href="/define.php\?term=\w+" name="\w+">([\w.-]+)</a>', html)
            if m:
                word = m.group(1)
                html = re.sub("^.+?</a>", "", html, re.S)
            text = out.unhtml(html)
            if not text:
                continue
            # at this point, it's becoming custom output to wrap flow text into Tk/ding window
            text = re.sub("^[\s|]+", "", text)
            text = textwrap.wrap(text, 45)
            print("%s %s :: %s" % (word, " | " * (len(text) - 1), "|".join(text)))
            
    def all(s, word):
        """ all | a | Run through all available services """
        for method in (s.thesaurus, s.merriamwebster, s.synonym, s.openthesaurus, s.woxikon, s.urban):
            method(word)
    def en(s, w):
        """ en | english """
        s.thesaurus(w)
        s.merriamwebster(w)
        s.synonym(w)
    def de(s, w):
        """ de | german """
        s.openthesaurus(w)
        s.woxikon(w)

# instantiate right away
lookup = lookup()


# __main__
def __main__():
    if len(sys.argv) == 1:
        return print("Syntax :: dingonyms --site word")
    word = "search"
    methods = []
    for arg in sys.argv[1:]:
        # separate --params from search word
        if not arg or arg == "--":
            continue
        elif not re.match("-", arg):
            word = arg
        else:
            for name, method in vars(lookup.__class__).items():
                if re.match("^[/+–-]+(%s)" % method.__doc__, arg, re.X|re.I|re.U):
                    methods.append(name)
    if not methods:
        methods = ["thesaurus"]
    for run in methods:
        getattr(lookup, run)(word)
    pass
if __main__ == "__init__":
    __main__()

Added dingonyms/man/dingonyms.1.

























































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
.\"t
.\" Automatically generated by Pandoc 2.5
.\"
.TH "dingonyms" "1" "" "for ding" "Version 0.1"
.hy
.SH NAME
.PP
dingonyms \[em] basic synonym/antonym lookup tool
.SH SYNOPSIS
.PP
\f[B]dingonyms\f[R] \[dq]word\[dq]
.PP
\f[B]dingonyms\f[R] [\f[I]\-\-thesaurus\f[R]]
[\f[I]\-\-merriamwebster\f[R]] [\f[I]\-\-synonym\f[R]] \[lq]find\[rq]
.PP
\f[B]dingonyms\f[R] [\f[I]\-\-openthesaurus\f[R] | \f[I]\-\-woxikon\f[R]
| \f[I]\-\-urban\f[R]] \[lq]Wort\[rq]
.PP
\f[B]dingonyms\f[R] \f[I]\-\-all\f[R] \[lq]word\[rq]
.SH DESCRIPTION
.PP
To be used as lookup tool for \f[B]ding\f[R](1).
Scans the specified online service for synonyms.
It\[cq]s not very useful as CLI tool by itself, because of the
particular dict formatting.
.SH PARAMS
.PP
Flags can be specified with one \- or two \-\- dashes.
They can also be abbreviated.
.PP
.TS
tab(@);
lw(18.9n) lw(43.5n) lw(7.6n).
T{
Parameter
T}@T{
Aliases
T}@T{
Class
T}
_
T{
\-\-thesaurus
T}@T{
\-t \[en]thes
T}@T{
EN
T}
T{
\-\-merriamwebster
T}@T{
\-mw \[en]merr \-\-webster \-\-merweb
T}@T{
EN
T}
T{
\-\-synonym
T}@T{
\-s \[en]syn \-\-synonym.com
T}@T{
EN
T}
T{
\-\-urban
T}@T{
\-u \[en]urb \-\-ubn
T}@T{
LEXICON
T}
T{
\-\-openthesaurus
T}@T{
\-ot \-\-othes \[en]open
T}@T{
DE
T}
T{
\-\-woxikon
T}@T{
\-wx \-\-woxi
T}@T{
DE
T}
.TE
.PP
They can also be combined (\f[B]dingonyms\f[R] \f[I]\-t \-mw \-u\f[R]
\[lq]find\[rq]), so two or more services get queried at once.
And obviously there\[cq]s also \f[I]\-all\f[R] to query all supported
sites.
.SH CONFIG
.PP
The search services can be configured through the GUI (somewhat fiddly
with Change+New), or by editing \f[I]\[ti]/.dingrc\f[R] directly.
To have all services present for example:
.IP
.nf
\f[C]
set searchmeth(3,name) {Synonyms}
set searchmeth(3,type) {3}
set searchmeth(3,dictfile) {}
set searchmeth(3,separator) { :: }
set searchmeth(3,language1) {Group}
set searchmeth(3,language2) {Synonyms}
set searchmeth(3,grepcmd) {dingonyms}
set searchmeth(3,grepopts) {\-\-thesaurus}
set searchmeth(3,maxlength) {30}
set searchmeth(3,maxresults) {200}
set searchmeth(3,minlength) {2}
set searchmeth(3,shapedresult) {1}
set searchmeth(3,foldedresult) {0}
set searchmeth(4,name) {Merriam\-Webster}
set searchmeth(4,type) {3}
set searchmeth(4,dictfile) {}
set searchmeth(4,separator) { :: }
set searchmeth(4,language1) {Group}
set searchmeth(4,language2) {Synonym}
set searchmeth(4,grepcmd) {dingonyms}
set searchmeth(4,grepopts) {\-\-merriamwebster}
set searchmeth(4,maxlength) {30}
set searchmeth(4,maxresults) {200}
set searchmeth(4,minlength) {2}
set searchmeth(4,shapedresult) {1}
set searchmeth(4,foldedresult) {0}
set searchmeth(5,name) {OpenThesaurus}
set searchmeth(5,type) {3}
set searchmeth(5,dictfile) {}
set searchmeth(5,separator) { :: }
set searchmeth(5,language1) {Group}
set searchmeth(5,language2) {Synonyms}
set searchmeth(5,grepcmd) {dingonyms}
set searchmeth(5,grepopts) {\-\-openthesaurus}
set searchmeth(5,maxlength) {30}
set searchmeth(5,maxresults) {200}
set searchmeth(5,minlength) {2}
set searchmeth(5,shapedresult) {1}
set searchmeth(5,foldedresult) {0}
set searchmeth(6,name) {Urban}
set searchmeth(6,type) {3}
set searchmeth(6,dictfile) {}
set searchmeth(6,separator) { :: }
set searchmeth(6,language1) {Word}
set searchmeth(6,language2) {Definition}
set searchmeth(6,grepcmd) {dingonyms}
set searchmeth(6,grepopts) {\-\-urban}
set searchmeth(6,maxlength) {30}
set searchmeth(6,maxresults) {200}
set searchmeth(6,minlength) {2}
set searchmeth(6,shapedresult) {1}
set searchmeth(6,foldedresult) {0}
\f[R]
.fi
.PP
\f[B]Beware not to overwrite existing custom entries.\f[R]
.SH SEE ALSO
.PP
\f[B]ding\f[R](1)

Added dingonyms/man/dingonyms.md.



















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
% dingonyms(1) for ding | Version 0.2


NAME
====

dingonyms — basic synonym/antonym lookup tool


SYNOPSIS
========

  **dingonyms** \"word\"

  **dingonyms** \[*\--thesaurus*] \[*\--merriamwebster*] \[*\--synonym*] "find"

  **dingonyms** \[*\--openthesaurus* | *\--woxikon* | *\--urban*] "Wort"

  **dingonyms** *\--all* "word"



DESCRIPTION
===========

To be used as lookup tool for **ding**(1). Scans the specified
online service for synonyms. It's not very useful as CLI tool
by itself, because of the particular dict formatting.



PARAMS
======

Flags can be specified with one \- or two \-\- dashes (or \+ signs even).
They can also be abbreviated.

+-------------------+---------------------------------------------+-------+
| Parameter         | Aliases                                     | Class |
+===================+=============================================+=======+
| \--thesaurus      | -t --thes                                   | EN    |
+-------------------+---------------------------------------------+-------+
| \--merriamwebster | -mw --merr \--webster \--merweb             | EN    |
+-------------------+---------------------------------------------+-------+
| \--synonym        | -s --syn -\-synonym.com                     | EN    |
+-------------------+---------------------------------------------+-------+
| \--urban          | -u --urb \--ubn                             |LEXICON|
+-------------------+---------------------------------------------+-------+
| \--openthesaurus  | -ot \--othes --open                         | DE    |
+-------------------+---------------------------------------------+-------+
| \--woxikon        | -wx \--woxi                                 | DE    |
+-------------------+---------------------------------------------+-------+

They can also be combined (**dingonyms** *-t -mw -u* "find"), so two
or more services get queried at once. And obviously there's also
*\--all* to query all supported sites.


CONFIG
======

The search services can be configured through the GUI (somewhat
fiddly with Change+New), or by editing *~/.dingrc* directly.
To have all services present for example:

    set searchmeth(3,name) {Synonyms}
    set searchmeth(3,type) {3}
    set searchmeth(3,dictfile) {}
    set searchmeth(3,separator) { :: }
    set searchmeth(3,language1) {Group}
    set searchmeth(3,language2) {Synonyms}
    set searchmeth(3,grepcmd) {dingonyms}
    set searchmeth(3,grepopts) {--thesaurus}
    set searchmeth(3,maxlength) {30}
    set searchmeth(3,maxresults) {200}
    set searchmeth(3,minlength) {2}
    set searchmeth(3,shapedresult) {1}
    set searchmeth(3,foldedresult) {0}
    set searchmeth(4,name) {Merriam-Webster}
    set searchmeth(4,type) {3}
    set searchmeth(4,dictfile) {}
    set searchmeth(4,separator) { :: }
    set searchmeth(4,language1) {Group}
    set searchmeth(4,language2) {Synonym}
    set searchmeth(4,grepcmd) {dingonyms}
    set searchmeth(4,grepopts) {--merriamwebster}
    set searchmeth(4,maxlength) {30}
    set searchmeth(4,maxresults) {200}
    set searchmeth(4,minlength) {2}
    set searchmeth(4,shapedresult) {1}
    set searchmeth(4,foldedresult) {0}
    set searchmeth(5,name) {OpenThesaurus}
    set searchmeth(5,type) {3}
    set searchmeth(5,dictfile) {}
    set searchmeth(5,separator) { :: }
    set searchmeth(5,language1) {Group}
    set searchmeth(5,language2) {Synonyms}
    set searchmeth(5,grepcmd) {dingonyms}
    set searchmeth(5,grepopts) {--openthesaurus}
    set searchmeth(5,maxlength) {30}
    set searchmeth(5,maxresults) {200}
    set searchmeth(5,minlength) {2}
    set searchmeth(5,shapedresult) {1}
    set searchmeth(5,foldedresult) {0}
    set searchmeth(6,name) {Urban}
    set searchmeth(6,type) {3}
    set searchmeth(6,dictfile) {}
    set searchmeth(6,separator) { :: }
    set searchmeth(6,language1) {Word}
    set searchmeth(6,language2) {Definition}
    set searchmeth(6,grepcmd) {dingonyms}
    set searchmeth(6,grepopts) {--urban}
    set searchmeth(6,maxlength) {30}
    set searchmeth(6,maxresults) {200}
    set searchmeth(6,minlength) {2}
    set searchmeth(6,shapedresult) {1}
    set searchmeth(6,foldedresult) {0}

**Beware not to overwrite existing custom entries.**

SETUP
=====

ding started from the Desktop environment might not find dingonyms, when
installed per pip. You'll have to symlink it:

    *ln -s ~/.local/bin/dingonyms ~/bin/*

Or reconfigure *~/.profile* to generally include ~/.local/bin; which doesn't
seem to be standard or default.


SEE ALSO
========

**ding**(1)

Added dingonyms/setup.py.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3
# encoding: utf-8
# api: pip
# type: build
# title: config for setuptools
#
# Always prefer setuptools over distutils
#

from pluginconf.setup import setup

setup(
    debug=1,
    fn="dingonyms.py",
    #long_description="README.md",
    packages=[""],
    package_dir={"": "."},
    py_modules=['dingonyms'],
    entry_points={
        "console_scripts": [
            "dingonyms=dingonyms:__main__",
        ]
    }
)