forthebadge forthebadge Gem Version

This gem was last updated on the 18.11.2021 (dd.mm.yyyy notation), at 02:32:43 o'clock.

Environment variable to use a specific yaml file

You can use an environment variable to denote the default yaml file in use. This allows you to use your own yaml file format, rather than the yaml files that are distributed with this gem.

The name of that environment variable must be DICTIONARIES_FILE. It shall point to your yaml file that holds the key-value pairs.

For example, if your file is at /opt/czech.yml, then DICTIONARIES_FILE should point at that location.

In bash, this may be equivalent to:

export DICTIONARIES_FILE=/opt/czech.yml

Note that in the long run, the dictionaries gem could be extended with these yaml files - or allow means to download these files over the www. But before we can do so, let's aim for at the least 100 words in such a file before we would consider distributing it or offering means to distribute said file.

sinatra

To start the sinatra interface of the dictionaries gem, do:

dictionaries --sinatra

Difficult english sentences

English is not the most difficult language in the world, but when it comes to proper pronounciation of words, english can be surprisingly difficult.

This subsection may keep a listing of sentences that, for one reason or the other, can be somewhat difficult to read out aloud without mistake, on a first try. It is just a fun-subsection, not meant to be taken too seriously; and it is quite subjective.

Without any further ado, here comes a listing of sentences that may be difficult to pronounce properly so:

I would like to distribute something.

Obtaining all translations into german for a given english word

Since as of November 2020 the following API exists:

Dictionaries.return_array_of_translated_words_from_online_leo('cat')
Dictionaries.return_array_of_translated_words_from_online_leo('dog')
Dictionaries.return_array_of_translated_words_from_online_leo('human')

This will return an Array of german names. It does not work 100% perfectly as it is based on a regex; and using a regex to parse HTML is never a trivial way. But if you just want to get the first entry, just call .first on it, and in most cases this is the best, most likely translation available.

The regex has to find matches to entries such as the following one:

</repr><words><word>der Jazzfan</word></words>

Anyone to come up with a more accurate regex is welcome to share it. :)

This functionality was specifically necessary because I needed to use this in the ruby-gtk bindings for this project.

Dictionaries.return_unique_words_from_this_file

This method will return all words that are presently not registered in the english dictionary.

The idea here is for me to slowly add more english words into the yaml file. I won't add every english word that exists, but I will try to aim for a seizable number in the long run, such as 5000 english words - already halfway there. \o/

GUI component

The GUI component of the dictionaries gem defaults to GTK3 finally. It is not a very advanced GUI, though.

First, install the gtk3 gem:

gem install gtk3

Then install the gtk_paradise project:

gem install gtk_paradise

Now you should be able to start the GUI component if the above has worked:

dictionaries --gui

See also the help options.

dictionaries --help

You may need to install some .h files if you use a specific Linux distribution; look at the relevant -dev packages for this. Or just compile from source. :)

The current version of ruby-gtk3 in October 2021 looks like this:

Yes, this isn't very pretty; I just wanted to focus a bit on the functionality. Tons of things are missing, such as switching to other .yml files from within the GUI itself. I just wanted to showcase a demo - the convert from english-to-german functionality is working, though, so the GUI is functional, even if not super-pretty.

Licence

Until the 17th of October 2019, this project was using the GPLv2 licence (no later clause).

However had, I believe that the GPLv2 licence is not great for a project that focuses on existing words in real languages, aka dictionaries. Thus, I have decided to change the licence into the MIT licence on that day (17.11.2019, in dd.mm.yyyy notation).

So the gem is now MIT licenced. There may be dragons! \o/

For a description of that licence, see https://opensource.org/licenses/MIT.

Contact information

If your creative mind has ideas and specific suggestions to make this gem more useful in general, feel free to drop me an email at any time, via:

shevy@inbox.lt

Before that email I used an email account at Google gmail, but in 2021 I decided to slowly abandon gmail for various reasons. In part this is because the UI annoys me (on non-chrome browser loading takes too long), but also because of Google's attempt to establish mass surveillance via its federated cohorts sniffing (FLoC). I do not know what happened at Google, but enough is enough - there is only so much you can take while supporting greed. When it comes to data mining done by private groups, ultimately the user became the product.

Do keep in mind that responding to emails may take some time, depending on the amount of work I may have at that moment, due to reallife time constraints. I will, however had, read feedback eventually. Patches and code changes are welcome too, of course, as long as they are in the spirit of the project at hand, e. g. fitting to the general theme. For this I may make use of github as a discussion site, but this has a low priority right now.