dictionaries 0.3.24
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of dictionaries might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +250 -0
- data/bin/dictionaries +7 -0
- data/bin/unique_words_in_this_file +7 -0
- data/dictionaries.gemspec +85 -0
- data/doc/README.gen +210 -0
- data/doc/todo/todo.md +5 -0
- data/lib/dictionaries/ask_english_word.rb +141 -0
- data/lib/dictionaries/ask_italian_word.rb +84 -0
- data/lib/dictionaries/class/ask_word_from_dictionary.rb +693 -0
- data/lib/dictionaries/class/colours.rb +55 -0
- data/lib/dictionaries/class/constants.rb +16 -0
- data/lib/dictionaries/class/set_search_for_this_word.rb +163 -0
- data/lib/dictionaries/commandline/parse_commandline.rb +75 -0
- data/lib/dictionaries/constants.rb +133 -0
- data/lib/dictionaries/gui/gtk3/dictionary/dictionary.rb +457 -0
- data/lib/dictionaries/gui/tk/README.md +2 -0
- data/lib/dictionaries/gui/tk/dictionary.rb +85 -0
- data/lib/dictionaries/helper_module/helper_module.rb +60 -0
- data/lib/dictionaries/project/project.rb +36 -0
- data/lib/dictionaries/require_project/require_project.rb +14 -0
- data/lib/dictionaries/sinatra/app.rb +118 -0
- data/lib/dictionaries/sinatra/english_to_german.rb +84 -0
- data/lib/dictionaries/statistics/statistics.rb +58 -0
- data/lib/dictionaries/toplevel_methods/e.rb +16 -0
- data/lib/dictionaries/toplevel_methods/english_to_german.rb +31 -0
- data/lib/dictionaries/toplevel_methods/has_key.rb +32 -0
- data/lib/dictionaries/toplevel_methods/is_on_roebe.rb +16 -0
- data/lib/dictionaries/toplevel_methods/main_file.rb +88 -0
- data/lib/dictionaries/toplevel_methods/misc.rb +185 -0
- data/lib/dictionaries/toplevel_methods/module_methods.rb +9 -0
- data/lib/dictionaries/toplevel_methods/show_help.rb +31 -0
- data/lib/dictionaries/version/version.rb +19 -0
- data/lib/dictionaries/yaml/chinese.yml +25 -0
- data/lib/dictionaries/yaml/danish.yml +4 -0
- data/lib/dictionaries/yaml/deutsche_fremdw/303/266rter.yml +1 -0
- data/lib/dictionaries/yaml/dutch.yml +3 -0
- data/lib/dictionaries/yaml/english.yml +2661 -0
- data/lib/dictionaries/yaml/farsi.yml +8 -0
- data/lib/dictionaries/yaml/finnish.yml +2 -0
- data/lib/dictionaries/yaml/italian.yml +532 -0
- data/lib/dictionaries/yaml/japanese.yml +15 -0
- data/lib/dictionaries/yaml/norwegian.yml +26 -0
- data/lib/dictionaries/yaml/portugese.yml +41 -0
- data/lib/dictionaries/yaml/russian.yml +10 -0
- data/lib/dictionaries/yaml/spanish.yml +133 -0
- data/lib/dictionaries/yaml/swedish.yml +104 -0
- data/lib/dictionaries.rb +1 -0
- metadata +209 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 85f1fbca6106f3c1012f0cf23f991bc0e3b1f6f04057015b527f62f68c80629e
|
4
|
+
data.tar.gz: 8295155d9d70075fcf97fecb9630dfcff508bccd8868c94b9808cef8c394b872
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e492537d701db7606e03d4074f099c9df11bc64d92a7d29948153e2a1c4a9654eea3e4afb98fc457b93e6844d26748d274889840a517623a5b914b44da9a594a
|
7
|
+
data.tar.gz: d050f4df29d19edc184df63a1ff33bc200a868204e1625ad5fa3f984ce19ee7f74c4d4681b9f09e589a6ff0086d5f4280b201d4e6d5b811d114acccebf374789
|
data/README.md
ADDED
@@ -0,0 +1,250 @@
|
|
1
|
+
[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://www.gobolinux.org/)
|
2
|
+
[![forthebadge](https://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/dictionaries.svg)](https://badge.fury.io/rb/dictionaries)
|
4
|
+
|
5
|
+
This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">21.03.2023</span> (dd.mm.yyyy notation), at <span style="color: steelblue; font-weight: bold">03:32:31</span> o'clock.
|
6
|
+
|
7
|
+
## Environment variable to use a specific yaml file
|
8
|
+
|
9
|
+
You can use an <b>environment variable</b> to denote the default
|
10
|
+
yaml file in use. This allows you to use your own yaml file
|
11
|
+
format, rather than the yaml files that are distributed with
|
12
|
+
this gem.
|
13
|
+
|
14
|
+
The name of that environment variable must be <b>DICTIONARIES_FILE</b>.
|
15
|
+
It shall point to your yaml file that holds the key-value pairs.
|
16
|
+
|
17
|
+
For example, if your file is at /opt/czech.yml, then
|
18
|
+
DICTIONARIES_FILE should point at that location.
|
19
|
+
|
20
|
+
In bash, this may be equivalent to:
|
21
|
+
|
22
|
+
export DICTIONARIES_FILE=/opt/czech.yml
|
23
|
+
|
24
|
+
Note that in the long run, the dictionaries gem could be extended
|
25
|
+
with these yaml files - or allow means to download these files
|
26
|
+
over the www. But before we can do so, let's aim for at the least
|
27
|
+
100 words in such a file before we would consider distributing
|
28
|
+
it or offering means to distribute said file.
|
29
|
+
|
30
|
+
## Difficult english sentences
|
31
|
+
|
32
|
+
English is not the most difficult language in the world, but when it
|
33
|
+
comes to proper pronounciation of words, english can be surprisingly
|
34
|
+
difficult.
|
35
|
+
|
36
|
+
This subsection may keep a listing of sentences that, for one reason
|
37
|
+
or the other, can be somewhat difficult to **read out aloud** without
|
38
|
+
mistake, on a first try. It is just a fun-subsection, not meant to be
|
39
|
+
taken too seriously; and it is quite subjective.
|
40
|
+
|
41
|
+
Without any further ado, here comes a listing of sentences that may
|
42
|
+
be difficult to pronounce properly so:
|
43
|
+
|
44
|
+
I would like to distribute something.
|
45
|
+
|
46
|
+
## Obtaining all translations into german for a given english word
|
47
|
+
|
48
|
+
Since as of **November 2020** the following API exists:
|
49
|
+
|
50
|
+
Dictionaries.return_array_of_translated_words_from_online_leo('cat')
|
51
|
+
Dictionaries.return_array_of_translated_words_from_online_leo('dog')
|
52
|
+
Dictionaries.return_array_of_translated_words_from_online_leo('human')
|
53
|
+
|
54
|
+
This will return an Array of german names. It does not work 100% perfectly
|
55
|
+
as it is based on a regex; and using a regex to parse HTML is never a
|
56
|
+
trivial way. But if you just want to get the first entry, just call
|
57
|
+
.first on it, and in most cases this is the best, most likely
|
58
|
+
translation available.
|
59
|
+
|
60
|
+
The regex has to find matches to entries such as the following one:
|
61
|
+
|
62
|
+
</repr><words><word>der Jazzfan</word></words>
|
63
|
+
|
64
|
+
Anyone to come up with a more accurate regex is welcome to share it. :)
|
65
|
+
|
66
|
+
This functionality was specifically necessary because I needed to
|
67
|
+
use this in the ruby-gtk bindings for this project.
|
68
|
+
|
69
|
+
## Dictionaries.return_unique_words_from_this_file
|
70
|
+
|
71
|
+
This method will return all words that are presently not registered
|
72
|
+
in the english dictionary.
|
73
|
+
|
74
|
+
The idea here is for me to slowly add more english words into the
|
75
|
+
yaml file. I won't add every english word that exists, but I will
|
76
|
+
try to aim for a seizable number in the long run, such as
|
77
|
+
5000 english words - already halfway there. \o/
|
78
|
+
|
79
|
+
## GUI component
|
80
|
+
|
81
|
+
The **GUI component** of the dictionaries gem defaults to
|
82
|
+
**GTK3** finally. It is not a very advanced GUI, though.
|
83
|
+
|
84
|
+
First, install the gtk3 gem:
|
85
|
+
|
86
|
+
gem install gtk3
|
87
|
+
|
88
|
+
Then install the gtk_paradise project:
|
89
|
+
|
90
|
+
gem install gtk_paradise
|
91
|
+
|
92
|
+
Now you should be able to start the GUI component if the above
|
93
|
+
has worked:
|
94
|
+
|
95
|
+
dictionaries --gui
|
96
|
+
|
97
|
+
See also the help options.
|
98
|
+
|
99
|
+
dictionaries --help
|
100
|
+
|
101
|
+
You may need to install some .h files if you use a specific
|
102
|
+
Linux distribution; look at the relevant -dev packages for
|
103
|
+
this. Or just compile from source. :)
|
104
|
+
|
105
|
+
The current version of ruby-gtk3 in October 2021 looks like
|
106
|
+
this:
|
107
|
+
|
108
|
+
<img src="https://i.imgur.com/K430Kae.png" style="margin-left: 2em">
|
109
|
+
|
110
|
+
Yes, this isn't very pretty; I just wanted to focus a bit on
|
111
|
+
the functionality. Tons of things are missing, such as
|
112
|
+
switching to other .yml files from within the GUI itself.
|
113
|
+
I just wanted to showcase a demo - the convert from
|
114
|
+
english-to-german functionality is working, though, so
|
115
|
+
the GUI is functional, even if not super-pretty.
|
116
|
+
|
117
|
+
In **February 2022** this was improved a little bit. It's still
|
118
|
+
not extremely pretty, but you can see a few small improvements.
|
119
|
+
In the long run I will add functionality to switch between
|
120
|
+
different .yml files (thus, different dictionaries, such as
|
121
|
+
english, italian and so forth) - but it is a hobby project.
|
122
|
+
I won't have enough time to add all dictionaries into this
|
123
|
+
project as-is. I will, however had, add the possibility to
|
124
|
+
load custom .yml files and other formats in the long run,
|
125
|
+
so others can adapt the project to suit their needs.
|
126
|
+
|
127
|
+
<img src="https://i.imgur.com/ChFJmfo.png" style="margin-left: 2em">
|
128
|
+
|
129
|
+
## sinatra
|
130
|
+
|
131
|
+
To start the sinatra interface of the dictionaries gem, do:
|
132
|
+
|
133
|
+
dictionaries --sinatra
|
134
|
+
|
135
|
+
You can then visit it on the localhost and it may look like
|
136
|
+
this:
|
137
|
+
|
138
|
+
<img src="https://i.imgur.com/uhzbXZ1.png" style="margin: 0.5em; margin-left: 2em">
|
139
|
+
|
140
|
+
You can then input an english word into the form, or the
|
141
|
+
URL area in your browser. If this word is registered in
|
142
|
+
the .yml file then the following result can be seen:
|
143
|
+
|
144
|
+
<img src="https://i.imgur.com/i1RqRmr.png" style="margin: 0.5em; margin-left: 2em">
|
145
|
+
|
146
|
+
This is really just very basic - I wanted to show the
|
147
|
+
functionality. You may have to adapt the code if you
|
148
|
+
have a more realistic use case, so consider the images
|
149
|
+
above just as examples of how this <b>could</b> be
|
150
|
+
used in a website.
|
151
|
+
|
152
|
+
## Generating a .pdf file containing the translations
|
153
|
+
|
154
|
+
Since as of <b>July 2022</b> you can generate a .pdf file
|
155
|
+
with all the translated words. This functionality depends
|
156
|
+
on the <b>prawn</b> gem right now, so make sure that
|
157
|
+
this gem is installed before invoking the ruby code
|
158
|
+
that generates the .pdf file.
|
159
|
+
|
160
|
+
The toplevel API for creating the .pdf file is as follows:
|
161
|
+
|
162
|
+
Dictionaries.generate_pdf_file
|
163
|
+
|
164
|
+
## Statistical information
|
165
|
+
|
166
|
+
On the <b>24.01.2023</b>, the Statistics submodule was
|
167
|
+
added towards module Dictionaries. The purpose of that
|
168
|
+
submodule is to simply display some information about
|
169
|
+
the project - in particular how many words are kept in
|
170
|
+
each individual .yml file (the yaml file that contains
|
171
|
+
all words in a given language).
|
172
|
+
|
173
|
+
For instance, on that day, the dictionaries gem contains
|
174
|
+
these word-translations in total:
|
175
|
+
|
176
|
+
chinese 15 words.
|
177
|
+
danish 1 words.
|
178
|
+
dutch 1 words.
|
179
|
+
english 2489 words.
|
180
|
+
farsi 4 words.
|
181
|
+
finnish 2 words.
|
182
|
+
italian 191 words.
|
183
|
+
japanese 2 words.
|
184
|
+
norwegian 5 words.
|
185
|
+
russian 3 words.
|
186
|
+
spanish 23 words.
|
187
|
+
swedish 1 words.
|
188
|
+
|
189
|
+
Expect more to be added over the coming months and years. As
|
190
|
+
can be seen english is the primary focus for this project,
|
191
|
+
in particular english-to-german and german-to-english.
|
192
|
+
|
193
|
+
Right now I am adding new entries manually for the most part,
|
194
|
+
but at a later point in time I may simply parse an existing
|
195
|
+
dictionary and then begin to add the missing entries more
|
196
|
+
systematically. Stay tuned for more information in this
|
197
|
+
regard in the future.
|
198
|
+
|
199
|
+
## Licence
|
200
|
+
|
201
|
+
Until the 17th of October 2019, this project was using the **GPLv2
|
202
|
+
licence** (no later clause).
|
203
|
+
|
204
|
+
However had, I believe that the GPLv2 licence is not great for
|
205
|
+
a project that focuses on existing words in **real languages**,
|
206
|
+
aka dictionaries. Thus, I have decided to change the licence into
|
207
|
+
the **MIT licence** on that day (**17.11.2019**, in dd.mm.yyyy notation).
|
208
|
+
|
209
|
+
So the gem is now MIT licenced. There may be dragons! \o/
|
210
|
+
|
211
|
+
For a description of that licence, see
|
212
|
+
https://opensource.org/licenses/MIT.
|
213
|
+
|
214
|
+
|
215
|
+
## Contact information and mandatory 2FA coming up in 2022
|
216
|
+
|
217
|
+
If your creative mind has ideas and specific suggestions to make this gem
|
218
|
+
more useful in general, feel free to drop me an email at any time, via:
|
219
|
+
|
220
|
+
shevy@inbox.lt
|
221
|
+
|
222
|
+
Before that email I used an email account at Google gmail, but in **2021** I
|
223
|
+
decided to slowly abandon gmail, for various reasons. In order to limit the
|
224
|
+
explanation here, allow me to just briefly state that I do not feel as if I
|
225
|
+
want to promote any Google service anymore when the user becomes the
|
226
|
+
product (such as via data collection by upstream services). I feel this is
|
227
|
+
a hugely flawed business model.
|
228
|
+
|
229
|
+
Do keep in mind that responding to emails may take some time, depending on
|
230
|
+
the amount of work I may have at that moment.
|
231
|
+
|
232
|
+
In <b>2022</b> rubygems.org, or rather the corporate overlords who control the
|
233
|
+
rubygems.org infrastructure these days, decided to make 2FA mandatory for every
|
234
|
+
gem owner eventually: see
|
235
|
+
https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html
|
236
|
+
|
237
|
+
Mandatory 2FA will eventually be extended to all rubygems.org developers and
|
238
|
+
maintainers. As I can not use 2FA, for reasons I will skip explaining here,
|
239
|
+
this means that my projects will eventually be taken over by shopify (or,
|
240
|
+
correspondingly, whoever effectively controls the rubygems.org ecosystem).
|
241
|
+
At that point, I no longer have any control what is done to my projects
|
242
|
+
since shopify (respectively those controlling the gems ecosystem) took away
|
243
|
+
control here. Not sure at which point ruby became corporate-controlled -
|
244
|
+
that was not the case several years ago.
|
245
|
+
|
246
|
+
Ruby also only allows 2FA users to participate on the issue tracker these
|
247
|
+
days:
|
248
|
+
|
249
|
+
https://bugs.ruby-lang.org/issues/18800
|
250
|
+
|
data/bin/dictionaries
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# =========================================================================== #
|
2
|
+
# Gemspec for Project Dictionaries.
|
3
|
+
# =========================================================================== #
|
4
|
+
require 'roebe'
|
5
|
+
require 'dictionaries/version/version.rb'
|
6
|
+
|
7
|
+
Gem::Specification.new { |s|
|
8
|
+
|
9
|
+
s.name = 'dictionaries'
|
10
|
+
s.version = Dictionaries::VERSION
|
11
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
12
|
+
|
13
|
+
DESCRIPTION = <<-EOF
|
14
|
+
|
15
|
+
This project is called dictionaries.
|
16
|
+
|
17
|
+
It used to be called ask_english_words but the name was changed towards
|
18
|
+
"dictionaries", when the focus became on dictionaries in general rather
|
19
|
+
than merely translations from and to the english language.
|
20
|
+
|
21
|
+
There are a total of #{Dictionaries.n_entries?} english words
|
22
|
+
registered, with the associated german translation. (It is
|
23
|
+
german primarily because that is my native language, but in
|
24
|
+
principle this project could be extended to include other
|
25
|
+
languages as well. You only need to add a yaml file containing
|
26
|
+
the key-value pairs.)
|
27
|
+
|
28
|
+
If you need a more comprehensive dictionary, I can recommend
|
29
|
+
the file de-en.txt that is part of the tu-chemnitz
|
30
|
+
distribution ( https://www-user.tu-chemnitz.de/~fri/ding/ ). That
|
31
|
+
file is really huge - about 20 MB.
|
32
|
+
|
33
|
+
In principle, the dictionaries project could be extended to
|
34
|
+
make use of that massive file instead. I will be thinking
|
35
|
+
about this for the time being (starting at July 2018).
|
36
|
+
|
37
|
+
EOF
|
38
|
+
|
39
|
+
s.summary = DESCRIPTION
|
40
|
+
s.description = DESCRIPTION
|
41
|
+
|
42
|
+
# ========================================================================= #
|
43
|
+
# Show this message when a user installs this project.
|
44
|
+
# ========================================================================= #
|
45
|
+
s.post_install_message = <<-EOF
|
46
|
+
|
47
|
+
This project can ask or translate english or italian words (or words
|
48
|
+
from any other language, as long as a .yml file is supplied that
|
49
|
+
contains these key-value pair entries).
|
50
|
+
|
51
|
+
This project is probably not very useful for other people, but it helps
|
52
|
+
me to improve my knowledge about the english or italian language or
|
53
|
+
any other language.
|
54
|
+
|
55
|
+
For more information, have a look at the main README.md file, which
|
56
|
+
can also be found on the hompage of this gem at rubygems.org, on
|
57
|
+
the bottom right side (see https://www.rubydoc.info/gems/dictionaries/ ).
|
58
|
+
|
59
|
+
EOF
|
60
|
+
|
61
|
+
s.extra_rdoc_files = %w()
|
62
|
+
|
63
|
+
s.authors = ['Robert A. Heiler']
|
64
|
+
s.email = Roebe.email?
|
65
|
+
s.files = Dir['**/*']
|
66
|
+
# s.files << 'README.md'
|
67
|
+
# s.files << 'USAGE.md'
|
68
|
+
s.license = 'MIT'
|
69
|
+
s.homepage = 'https://www.rubydoc.info/gems/dictionaries/'
|
70
|
+
|
71
|
+
s.required_ruby_version = '>= '+Roebe.third_most_stable_version_of_ruby
|
72
|
+
s.required_rubygems_version = '>= '+Gem::VERSION
|
73
|
+
s.rubygems_version = '>= '+Gem::VERSION
|
74
|
+
|
75
|
+
# ========================================================================= #
|
76
|
+
# External dependencies for the project:
|
77
|
+
# ========================================================================= #
|
78
|
+
s.add_dependency 'colours'
|
79
|
+
s.add_dependency 'generate_shell_completion'
|
80
|
+
s.add_dependency 'opn'
|
81
|
+
s.add_dependency 'open'
|
82
|
+
s.add_dependency 'save_file'
|
83
|
+
s.add_dependency 'xorg_buffer'
|
84
|
+
|
85
|
+
}
|
data/doc/README.gen
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
DEFAULT_HEADER
|
2
|
+
|
3
|
+
## Environment variable to use a specific yaml file
|
4
|
+
|
5
|
+
You can use an <b>environment variable</b> to denote the default
|
6
|
+
yaml file in use. This allows you to use your own yaml file
|
7
|
+
format, rather than the yaml files that are distributed with
|
8
|
+
this gem.
|
9
|
+
|
10
|
+
The name of that environment variable must be <b>DICTIONARIES_FILE</b>.
|
11
|
+
It shall point to your yaml file that holds the key-value pairs.
|
12
|
+
|
13
|
+
For example, if your file is at /opt/czech.yml, then
|
14
|
+
DICTIONARIES_FILE should point at that location.
|
15
|
+
|
16
|
+
In bash, this may be equivalent to:
|
17
|
+
|
18
|
+
export DICTIONARIES_FILE=/opt/czech.yml
|
19
|
+
|
20
|
+
Note that in the long run, the dictionaries gem could be extended
|
21
|
+
with these yaml files - or allow means to download these files
|
22
|
+
over the www. But before we can do so, let's aim for at the least
|
23
|
+
100 words in such a file before we would consider distributing
|
24
|
+
it or offering means to distribute said file.
|
25
|
+
|
26
|
+
## Difficult english sentences
|
27
|
+
|
28
|
+
English is not the most difficult language in the world, but when it
|
29
|
+
comes to proper pronounciation of words, english can be surprisingly
|
30
|
+
difficult.
|
31
|
+
|
32
|
+
This subsection may keep a listing of sentences that, for one reason
|
33
|
+
or the other, can be somewhat difficult to **read out aloud** without
|
34
|
+
mistake, on a first try. It is just a fun-subsection, not meant to be
|
35
|
+
taken too seriously; and it is quite subjective.
|
36
|
+
|
37
|
+
Without any further ado, here comes a listing of sentences that may
|
38
|
+
be difficult to pronounce properly so:
|
39
|
+
|
40
|
+
I would like to distribute something.
|
41
|
+
|
42
|
+
## Obtaining all translations into german for a given english word
|
43
|
+
|
44
|
+
Since as of **November 2020** the following API exists:
|
45
|
+
|
46
|
+
Dictionaries.return_array_of_translated_words_from_online_leo('cat')
|
47
|
+
Dictionaries.return_array_of_translated_words_from_online_leo('dog')
|
48
|
+
Dictionaries.return_array_of_translated_words_from_online_leo('human')
|
49
|
+
|
50
|
+
This will return an Array of german names. It does not work 100% perfectly
|
51
|
+
as it is based on a regex; and using a regex to parse HTML is never a
|
52
|
+
trivial way. But if you just want to get the first entry, just call
|
53
|
+
.first on it, and in most cases this is the best, most likely
|
54
|
+
translation available.
|
55
|
+
|
56
|
+
The regex has to find matches to entries such as the following one:
|
57
|
+
|
58
|
+
</repr><words><word>der Jazzfan</word></words>
|
59
|
+
|
60
|
+
Anyone to come up with a more accurate regex is welcome to share it. :)
|
61
|
+
|
62
|
+
This functionality was specifically necessary because I needed to
|
63
|
+
use this in the ruby-gtk bindings for this project.
|
64
|
+
|
65
|
+
## Dictionaries.return_unique_words_from_this_file
|
66
|
+
|
67
|
+
This method will return all words that are presently not registered
|
68
|
+
in the english dictionary.
|
69
|
+
|
70
|
+
The idea here is for me to slowly add more english words into the
|
71
|
+
yaml file. I won't add every english word that exists, but I will
|
72
|
+
try to aim for a seizable number in the long run, such as
|
73
|
+
5000 english words - already halfway there. \o/
|
74
|
+
|
75
|
+
## GUI component
|
76
|
+
|
77
|
+
The **GUI component** of the dictionaries gem defaults to
|
78
|
+
**GTK3** finally. It is not a very advanced GUI, though.
|
79
|
+
|
80
|
+
First, install the gtk3 gem:
|
81
|
+
|
82
|
+
gem install gtk3
|
83
|
+
|
84
|
+
Then install the gtk_paradise project:
|
85
|
+
|
86
|
+
gem install gtk_paradise
|
87
|
+
|
88
|
+
Now you should be able to start the GUI component if the above
|
89
|
+
has worked:
|
90
|
+
|
91
|
+
dictionaries --gui
|
92
|
+
|
93
|
+
See also the help options.
|
94
|
+
|
95
|
+
dictionaries --help
|
96
|
+
|
97
|
+
You may need to install some .h files if you use a specific
|
98
|
+
Linux distribution; look at the relevant -dev packages for
|
99
|
+
this. Or just compile from source. :)
|
100
|
+
|
101
|
+
The current version of ruby-gtk3 in October 2021 looks like
|
102
|
+
this:
|
103
|
+
|
104
|
+
<img src="https://i.imgur.com/K430Kae.png" style="margin-left: 2em">
|
105
|
+
|
106
|
+
Yes, this isn't very pretty; I just wanted to focus a bit on
|
107
|
+
the functionality. Tons of things are missing, such as
|
108
|
+
switching to other .yml files from within the GUI itself.
|
109
|
+
I just wanted to showcase a demo - the convert from
|
110
|
+
english-to-german functionality is working, though, so
|
111
|
+
the GUI is functional, even if not super-pretty.
|
112
|
+
|
113
|
+
In **February 2022** this was improved a little bit. It's still
|
114
|
+
not extremely pretty, but you can see a few small improvements.
|
115
|
+
In the long run I will add functionality to switch between
|
116
|
+
different .yml files (thus, different dictionaries, such as
|
117
|
+
english, italian and so forth) - but it is a hobby project.
|
118
|
+
I won't have enough time to add all dictionaries into this
|
119
|
+
project as-is. I will, however had, add the possibility to
|
120
|
+
load custom .yml files and other formats in the long run,
|
121
|
+
so others can adapt the project to suit their needs.
|
122
|
+
|
123
|
+
<img src="https://i.imgur.com/ChFJmfo.png" style="margin-left: 2em">
|
124
|
+
|
125
|
+
## sinatra
|
126
|
+
|
127
|
+
To start the sinatra interface of the dictionaries gem, do:
|
128
|
+
|
129
|
+
dictionaries --sinatra
|
130
|
+
|
131
|
+
You can then visit it on the localhost and it may look like
|
132
|
+
this:
|
133
|
+
|
134
|
+
<img src="https://i.imgur.com/uhzbXZ1.png" style="margin: 0.5em; margin-left: 2em">
|
135
|
+
|
136
|
+
You can then input an english word into the form, or the
|
137
|
+
URL area in your browser. If this word is registered in
|
138
|
+
the .yml file then the following result can be seen:
|
139
|
+
|
140
|
+
<img src="https://i.imgur.com/i1RqRmr.png" style="margin: 0.5em; margin-left: 2em">
|
141
|
+
|
142
|
+
This is really just very basic - I wanted to show the
|
143
|
+
functionality. You may have to adapt the code if you
|
144
|
+
have a more realistic use case, so consider the images
|
145
|
+
above just as examples of how this <b>could</b> be
|
146
|
+
used in a website.
|
147
|
+
|
148
|
+
## Generating a .pdf file containing the translations
|
149
|
+
|
150
|
+
Since as of <b>July 2022</b> you can generate a .pdf file
|
151
|
+
with all the translated words. This functionality depends
|
152
|
+
on the <b>prawn</b> gem right now, so make sure that
|
153
|
+
this gem is installed before invoking the ruby code
|
154
|
+
that generates the .pdf file.
|
155
|
+
|
156
|
+
The toplevel API for creating the .pdf file is as follows:
|
157
|
+
|
158
|
+
Dictionaries.generate_pdf_file
|
159
|
+
|
160
|
+
## Statistical information
|
161
|
+
|
162
|
+
On the <b>24.01.2023</b>, the Statistics submodule was
|
163
|
+
added towards module Dictionaries. The purpose of that
|
164
|
+
submodule is to simply display some information about
|
165
|
+
the project - in particular how many words are kept in
|
166
|
+
each individual .yml file (the yaml file that contains
|
167
|
+
all words in a given language).
|
168
|
+
|
169
|
+
For instance, on that day, the dictionaries gem contains
|
170
|
+
these word-translations in total:
|
171
|
+
|
172
|
+
chinese 15 words.
|
173
|
+
danish 1 words.
|
174
|
+
dutch 1 words.
|
175
|
+
english 2489 words.
|
176
|
+
farsi 4 words.
|
177
|
+
finnish 2 words.
|
178
|
+
italian 191 words.
|
179
|
+
japanese 2 words.
|
180
|
+
norwegian 5 words.
|
181
|
+
russian 3 words.
|
182
|
+
spanish 23 words.
|
183
|
+
swedish 1 words.
|
184
|
+
|
185
|
+
Expect more to be added over the coming months and years. As
|
186
|
+
can be seen english is the primary focus for this project,
|
187
|
+
in particular english-to-german and german-to-english.
|
188
|
+
|
189
|
+
Right now I am adding new entries manually for the most part,
|
190
|
+
but at a later point in time I may simply parse an existing
|
191
|
+
dictionary and then begin to add the missing entries more
|
192
|
+
systematically. Stay tuned for more information in this
|
193
|
+
regard in the future.
|
194
|
+
|
195
|
+
## Licence
|
196
|
+
|
197
|
+
Until the 17th of October 2019, this project was using the **GPLv2
|
198
|
+
licence** (no later clause).
|
199
|
+
|
200
|
+
However had, I believe that the GPLv2 licence is not great for
|
201
|
+
a project that focuses on existing words in **real languages**,
|
202
|
+
aka dictionaries. Thus, I have decided to change the licence into
|
203
|
+
the **MIT licence** on that day (**17.11.2019**, in dd.mm.yyyy notation).
|
204
|
+
|
205
|
+
So the gem is now MIT licenced. There may be dragons! \o/
|
206
|
+
|
207
|
+
For a description of that licence, see
|
208
|
+
https://opensource.org/licenses/MIT.
|
209
|
+
|
210
|
+
ADD_CONTACT_INFORMATION
|