Using Perl to Learn a Foreign Language

Mark Allen found himself trying to pull back from Twitter and needed to do something with his smartphone. He had some experience with Russian in the past, so he began using DuoLingo to really learn the language.

Quick Intro to Russian

Russian is spoken by around 150 million people world-wide. It is a Slavic language, with gendered nouns, that have singular and plural forms. Pronouns, nouns, and adjectives decline in six grammatical cases. The declinations result in changes in the endings of related words. There are differences between animate and inanimate nouns.

Perl Enters the Picture

In his learning, he ran across a YouTube video of a person creating sentences with all the cases to simplify remembering the endings. Mark decided he wanted to be able to create his own sentences. The obvious solution is to write a program to generate these sentences. He chose Perl for its UTF-8 support, CSV libraries, and ease of extension.

Mark wrote Lingua::RU::Declension as a prototype in a couple of hours. It targets Perl 5.14 and later. It uses the utf8 pragma to allow using Russian characters in the source. It doesn't decline arbitrary words, working only with nouns and adjectives that are built-in. The library also does not support parsing arbitrary Russian language. He has learned quite a bit about the edges of his understanding of the grammar based on corrections from Russian-speakers on-line.

Once he had a way to decline Russian, Mark found the Anki flashcard software. This software can be driven by CSV data as input. He used Forvo for pronunciation by native speakers. Using these pieces, he was able to create a script to build flashcards.

Mark's slides are available on OneDrive. His code is available on github.

We had 10 people attending this month. As always, we'd like to thank cPanel, Inc. for providing the meeting space and food for the group.