In the second week, I focused on the other Countries-activity issue, namely the feature to introduce partial checks. If a user came close to guessing a country’s name, but was off but a letter or two, there would be a prompt suggesting whether the user meant the particular country. If the user clicks yes, the activity would go on to show the correct country and the flag and clicking no would show a prompt saying that no country of that name exists.
The feature in itself is a simple one, but pedagogically a very important one. A child can learn faster if he’s sometimes shown hints as it helps to remember it better. The implementation in itself was quite simple, I did make a few changes to the layout, font and color. One of the drawbacks that I felt was that the letters are a part of an image, and not drawn separately by the activity, which makes it space constraint. I added the prompts and a way for the user to validate them.
However, the most interesting aspect was to determine how far off is a user’s input against an actual answer. The easiest method would be to count the nummber of letters the input is off by. However, that is a very simplistic way to go about doing things. For example, an input of “Chine” can be either “China” or “Chile”. I realised my first implementation was very primitive and decided to refer sources on the internet. My mentor pointed an article by Peter Norvig, who is a computer scientist working at Google, (refer to the link below to know more about him), where he had described a simple mathematical model that served as a spell checker. Despite being so simple, it had a very high level of accuracy in prediticting the right spellings. With a little modification I based my “off-by-X” algorithm on the model proposed by Peter Norvig and got excellent results.
The other issue I took up was the implementation of the URL click feature on the Terminal-activity. Most GNOME based Terminal-emulators support URL and file address, recognition and the corresponding link can be clicked, which directly open the URL or the file. The Terminal-activity is based on Vte, which is a GNOME based Terminal widget, mostly used to created Terminal-emulators. I approached the issue by first reading through the GNOME source code and another Vte based Terminal-emulator called Guake, to understand how the URL recognition algorithm works.
I have included the link to the discussion that took place regarding the implementation of the activity below. The PR is still open and in progress.