What structures a language is the grammar we define, may it be a specific system (for instance, the ‘grammar of graphics’ that define ‘gg’plot2), a programming language (wherein context-free grammar is used for parsing), an expression (wherein regular grammar is used in RegEx) contained within, or the conversational languages we use in day to day life. And grammar is nothing but a set of pre-defined rules (subject to change) that often take the form of ‘if this - then do this; else if this - then do this; … else - do that’.
Consider the French language. It has two categories of verbs, namely ‘regular’ and ‘irregular’. The verbs when accompanied by a subject or a preceding direct object, undergo conjugation which changes the verb composition with respect to the subject or object pronouns.
The certain rule-based part I’m hinting at here is given by the fact that French verbs are conventionally divided into three conjugations, with the endings ‘er’, ‘ir’ and ‘re’. These are attached right next to a ‘base’, or what linguists may commonly refer to as the ‘stem’ part of the verb, although the interchangeable use comes with a subtle difference. For instance, the stem of parler (to speak) is ‘parle’, whereas the ‘base’ I’m considering here would be ‘parl’, i.e. the verb minus the ‘er’ suffix.
With respect to the base, the regular verbs falling within these three cases follow a distinct pattern of suffix-replacement to attain their conjugated forms for the first, second and third person subject pronouns: (considering simple present tense, indicative mood)
Subject pronouns | Conjugated-form (original: base + er) | Conjugated-form (original: base + ir) | Conjugated-form (original: base + re) |
Je | base + e | base + is | base + s |
Tu | base + es | base + is | base + s |
Il | base + e | base + it | base |
Elle | base + e | base + it | base |
Nous | base + ons | base + issons | base + ons |
Vous | base + ez | base + issez | base + ez |
Ils | base + ent | base + issent | base + ent |
Elles | base + ent | base + issent | base + ent |
Given that there are certain grammatical rules that apply here (following the above constructs), this principle in itself could call for automation, and this idea as a whole can pose as a candidate for making a program out of.
Thus, I recently created my first Julia program (having dealt with R and Python, learning the syntax was easy enough!), albeit a simple one that uses the above knowledgebase to provide conjugated forms of a french verb.
For instance, regular verbs with the ‘er’ suffix when accompanied by Nous (We) will have the ‘ons’ suffix, the code for which will be:
base = chop(verb, tail = 2)
if endswith(verb, "er")
println("Nous ", base, "ons")
There are, however, exceptions to this rule, coming from the ‘irregular’ variant. These verbs (aller, faire, voir etc.) do not follow the above formula, nor do they guarantee a fixed suffix each to categorize them into another standard group. Not to mention there’s a boatload of them, including the auxiliary verbs ‘Avoir’ and ‘Être’ (to have and to be) under the same page.
For example, here are the simple present tense (indicative mood/l’indicatif) conjugations for the aforementioned verbs:
Subject pronouns | Avoir | Être | Aller | Faire | Voir |
J’/Je | ai | suis | vais | fais | vois |
Tu | as | es | vas | fais | vois |
Il | a | est | va | fait | voit |
Elle | a | est | va | fait | voit |
Nous | avons | sommes | allons | faisons | voyons |
Vous | avez | êtes | allez | faites | voyez |
Ils | ont | sont | vont | font | voient |
Elles | a | est | vont | font | voient |
To incorporate these exceptions one by one would feel like swaying back from the pattern-using behaviour of programming, given the limited generalization. Thus, it would be sensible and better to restrict the usage to regular verbs and prompt the user to input them specifically (and not just any verb). This gives the current state of Conjugation.jl.
Pluralization of French nouns is another topic I made a program on, which includes a similar suffix-changing logic (but these might not apply to all words as well!) based on this knowledge:
Noun suffix | Plural form suffix |
s | s |
x | x |
z | z |
au | aux |
ou | oux |
eu | eux |
al | aux |
eau | eaux |
Anirban | 04/12/2021 |