forthebadge forthebadge Gem Version

This gem was last updated on the 30.07.2022 (dd.mm.yyyy notation), at 16:17:55 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.

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.

In February 2022 this was improved a little bit. It's still not extremely pretty, but you can see a few small improvements. In the long run I will add functionality to switch between different .yml files (thus, different dictionaries, such as english, italian and so forth) - but it is a hobby project. I won't have enough time to add all dictionaries into this project as-is. I will, however had, add the possibility to load custom .yml files and other formats in the long run, so others can adapt the project to suit their needs.

sinatra

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

dictionaries --sinatra

You can then visit it on the localhost and it may look like this:

You can then input an english word into the form, or the URL area in your browser. If this word is registered in the .yml file then the following result can be seen:

This is really just very basic - I wanted to show the functionality. You may have to adapt the code if you have a more realistic use case, so consider the images above just as examples of how this could be used in a website.

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 and mandatory 2FA coming up in 2022

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 order to limit this explanation here, allow me to just briefly state that I do not feel as if I want to promote any Google service anymore, for various reasons.

Do keep in mind that responding to emails may take some time, depending on the amount of work I may have at that moment.

In 2022 rubygems.org decided to make 2FA mandatory for every gem owner: see https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html

As I can not use 2FA, for reasons I will skip explaining here (see various github issue discussions in the past), this effectively means that Betty Li and others who run the show at rubygems.org will perma-ban me from using rubygems as a developer.

As I disagree with that decision completely, this will mean that all my gems will be removed from rubygems.org prior to that sunset date, e. g. before they permanently lock me out from the code that I used to maintain. It is pointless to want to discuss this with them anymore - they have made up their minds and decided that you can only use the code if 2FA is in place, even though the code itself works just fine. If you don't use 2FA you are effectively locked out from your own code; I consider this a malicious attack. See also how they limited discussions to people with mandatory 2FA on the ruby-bugtracker, thus banning everyone permanently without 2FA:

https://bugs.ruby-lang.org/issues/18800

Guess it may indeed be time to finally abandon ruby - not because ruby is a bad language, but there are people now in charge who really should not be part of ruby in the first place.