Print the full conjugation of a French verb

8

1

Given a string ending in either "er", "ir", or "re" (the "infinitive"), output the full conjugation of the string as a French verb in the seven simple tenses. For each tense (in the order given below), output each subject pronoun in the following order: je, tu, il, elle, nous, vous, ils, elles; followed by a space, the verb conjugated according to that pronoun, and a newline. If the verb begins with a vowel (aeiou) or h, je becomes j' and the space is omitted.

In all the examples, I will use the regular verbs exister, invertir, and rendre to demonstrate. French has a great many irregular verbs, which we shall ignore to make the specification and challenge easier.

The tenses

Present tense

Remove the er/ir/re from the infinitive and add the following endings:

  • er: j'existe, tu existes, il existe, elle existe, nous existons, vous existez, ils existent, elles existent.
  • ir: j'invertis, tu invertis, il invertit, elle invertit, nous invertissons, vous invertissez, ils invertissent.
  • re: je rends, tu rends, il rend, elle rend (no endings), nous rendons, vous rendez, ils rendent, elles rendent.

Imperfect

Remove the er/ir/re from the infinitive and add the following endings:

  • er and re: j'existais, tu existais, il existait, elle existait, nous existions, vous existiez, ils existaient, elles existaient.
  • ir: j'invertissais, tu invertissais, il invertissait, elle invertissait, nous invertissions, vous invertissiez, ils invertissaient.

Simple past

Remove the er/ir/re from the infinitive and add the following endings:

  • er: j'existai, tu existas, il exista, elle exista, nous existâmes, vous existâtes, ils existèrent, elles existèrent.
  • ir and re: je rendis, tu rendis, il rendit, elle rendit, nous rendîmes, vous rendîtes, ils rendirent, elles rendirent.

Future

For all verbs, add these endings directly to the infinitive (though re verbs drop the e):

  • j'invertirai, tu invertiras, il invertira, elle invertira, nous invertirons, vous invertirez, ils invertiront, elles invertiront.

Conditional

For all verbs, add these endings directly to the infinitive (though re verbs drop the e):

  • j'invertirais, tu invertirais, il invertirait, elle invertirait, nous invertirions, vous invertiriez, ils invertiraient, elles invertiraient*.

Present subjunctive

Remove the er/ir/re from the infinitive and add the following endings:

  • er and re: j'existe, tu existes, il existe, elle existe, nous existions, vous existiez, ils existent, elles existent.
  • ir: j'invertisse, tu invertisses, il invertisse, elle invertisse, nous invertissions, vous invertissiez, ils invertissent, elles invertissent.

Imperfect subjunctive

Remove the er/ir/re from the infinitive and add the following endings:

  • er: j'existasse, tu existasses, il existât, elle existât, nous existassions, vous existassiez, ils existassent, elles existassent.
  • ir and re: je rendisse, tu rendisses, il rendît, elle rendît, nous rendissions, vous rendissiez, ils rendissent, elles rendissent.

Sample output

For an er verb, aller, your output should be:

j'alle
tu alles
il alle
elle alle
nous allons
vous allez
ils allent
elles allent
j'allais
tu allais
il allait
elle allait
nous allions
vous alliez
ils allaient
elles allaient
j'allai
tu allas
il alla
elle alla
nous allâmes
vous allâtes
ils allèrent
elles allèrent
j'allerai
tu alleras
il allera
elle allera
nous allerons
vous allerez
ils alleront
elles alleront
j'allerais
tu allerais
il allerait
elle allerait
nous allerions
vous alleriez
ils alleraient
elles alleraient
j'alle
tu alles
il alle
elle alle
nous allions
vous alliez
ils allent
elles allent
j'allasse
tu allasses
il allât
elle allât
nous allassions
vous allassiez
ils allassent
elles allassent

For an ir verb, avoir, your output should be:

j'avois
tu avois
il avoit
elle avoit
nous avoissons
vous avoissez
ils avoissent
elles avoissent
j'avoissais
tu avoissais
il avoissait
elle avoissait
nous avoissions
vous avoissiez
ils avoissaient
elles avoissaient
j'avois
tu avois
il avoit
elle avoit
nous avoîmes
vous avoîtes
ils avoirent
elles avoirent
j'avoirai
tu avoiras
il avoira
elle avoira
nous avoirons
vous avoirez
ils avoiront
elles avoiront
j'avoirais
tu avoirais
il avoirait
elle avoirait
nous avoirions
vous avoiriez
ils avoiraient
elles avoiraient
j'avoisse
tu avoisses
il avoisse
elle avoisse
nous avoissions
vous avoissiez
ils avoissent
elles avoissent
j'avoisse
tu avoisses
il avoît
elle avoît
nous avoissions
vous avoissiez
ils avoissent
elles avoissent

For an re verb, faire, your output should be:

je fais
tu fais
il fai
elle fai
nous faions
vous faiez
ils faient
elles faient
je faiais
tu faiais
il faiait
elle faiait
nous faiions
vous faiiez
ils faiaient
elles faiaient
je faiis
tu faiis
il faiit
elle faiit
nous faiîmes
vous faiîtes
ils faiirent
elles faiirent
je fairai
tu fairas
il faira
elle faira
nous fairons
vous fairez
ils fairont
elles fairont
je fairais
tu fairais
il fairait
elle fairait
nous fairions
vous fairiez
ils fairaient
elles fairaient
je faie
tu faies
il faie
elle faie
nous faiions
vous faiiez
ils faient
elles faient
je faiisse
tu faiisses
il faiît
elle faiît
nous faiissions
vous faiissiez
ils faiissent
elles faiissent

(These are not the true conjugations of the above verbs. In reality they are highly irregular.)

This is code golf. The shortest submission wins.

Purple P

Posted 2019-09-03T00:33:10.613

Reputation: 919

3I think using manger, finir and (entre)prendre as example should be better, feels like you intentionally took irregular verbs :) – jonatjano – 2019-09-03T07:31:24.150

4@jonatjano (entre)prendre is irregular as well. So maybe entendre instead. (But I do agree that the current examples look awful if you happen to know French.) – Arnauld – 2019-09-03T08:04:20.110

3@Arnauld I happen to BE french and it really hurts :) and yes I forgot (entre)prendre was irregullar entendre is really better – jonatjano – 2019-09-03T08:06:07.670

1Does y count as a vowel in French / for this challenge? – Kevin Cruijssen – 2019-09-03T08:50:06.030

1I echo the previous comments: Please update the test cases to use regular verbs and include a note in the spec that special casing the irregular verbs is beyond the scope of the challenge. – Shaggy – 2019-09-03T10:50:27.690

3@KevinCruijssen I'll let the OP decide but as a native French speaker, I would definitely say je yoyote rather than j'yoyote (although a few sites do suggest the latter). – Arnauld – 2019-09-03T11:35:44.190

@Arnauld Ok, in that case I'd indeed say to exclude it as well. In Dutch the letter y is counted as a vowel in general, but for all Dutch verbs I know of with a leading y it's used as a consonant. I see it's similar for French after a quick Google search, based on these French verbs: yoyoter; youtser; yasser; yodler.

– Kevin Cruijssen – 2019-09-03T12:06:11.980

1What torture is this? Bad memories of 3rd form French class! :) – roblogic – 2019-09-03T12:37:10.423

@Shaggy It was there from the start: "French has a great many irregular verbs, which we shall ignore to make the specification and challenge easier." – Purple P – 2019-09-03T14:50:53.053

2I don't think that @Shaggy was implying that there's a problem with the spec, but rather just a problem with the test cases -- because there's little point in applying regular rules to irregular verbs. – Arnauld – 2019-09-03T16:04:17.747

Answers

2

Charcoal, 488 276 bytes

F⪪§⪪”}∨>↓⁷8lυW!M\ηX↨%]ν÷g×D\﹪3}Þ1Xζ÷S¹.m×K⦄}.}◧TI¡νυOA×∨´TE…8λ→Y×⁶⁰⟦αLi↓↶⎚⦃ω>◧‴κv≦|≕…K⊕Yλ⎇&✳⍘ςθA⪪@₂)¦Hg@»‽H2.⁵÷-⁸n¬u⊘¡″βEN≡x↔÷Wyⅈ(J\`﹪◨⁸||kU_ ←%Zσ¤«⊟Q§!χ⁰⸿¤:\`α´↖±↔5À⊗I¡o⊞⁵cp✳ιg«“/_$↖↧↧⪫,↗A”¶¶⌕er§θ±²¶F⁶F⎇›№aehiou§θ⁰κ⟦j'⟧⁺⪪§⪪”↶↥ζ⊟pW↔,⦄≡WA→÷⪫$Aⅉ⟦v⎇” 궦 «λ…θ⁻Lθ²⭆§⪪ι κ§⁺âèîμ⌕AEIμ⸿

Try it online! Link is to verbose version of code. Explanation:

F⪪§⪪”...”¶¶⌕er§θ±²¶

A very long compressed string is split into paragraphs, each paragraph representing the endings for a particular verb ending. The appropriate ending is selected depending on the second last letter in the verb. The paragraph is split into lines representing the endings for each tense in turn. The tenses are then looped over.

F⁶

Loop over the three persons and their plurals.

F⎇›№aehiou§θ⁰κ⟦j'⟧⁺⪪§⪪”↶↥ζ⊟pW↔,⦄≡WA→÷⪫$Aⅉ⟦v⎇” 궦 «

Loop over the pronouns for those persons (third person has two genders), but special-casing ["j'"] where necessary.

λ

Print the pronoun.

…θ⁻Lθ²

Print the verb stem.

⭆§⪪ι κ§⁺âèîμ⌕AEIμ

Print the suffix, but translate AEI to âèî as Charcoal can't compress accented letters.

⸿

Start a new line.

Neil

Posted 2019-09-03T00:33:10.613

Reputation: 95 035

5

JavaScript (ES6),  507  504 bytes

Returns an array of 7 tenses, where each tense is an array of 8 forms.

(v,[a,b]=v.split(/(..)$/),g=b>'r'?2:b<'i')=>[...S='0123456'].map(x=>'je/tu/il/elle/nous/vous/ils/elles'.split`/`.map((s,n)=>(!n*/^[aehiou]/.test(a)?"j'":s+' ')+a+(x>2&x<5?g>1?'r':b:'')+[...S+'789ABCD'].reduce((p,c)=>(l=p.split(c)).join(l.pop()),'55e91D4D3D7/s//9eC0s00tBai72AA/âm5âtes/èr1/îm5îtes8r72AA9oC/55e8483/7DeDeDeB76e65ât6i46i367DeD5îtB7D8ssCn2s22t848327BDi4Di3DA/a9/4/3/8/i7en6Ass5e/4on3ez2Ai178s88t0Dai').split`/`[(n-=n>2,n-=n>5)+('0x'+'102433656777888A99CBC'[x*3+g])*6]+['sst'[~-n/2]]))

Try it online! (regular verbs)

Try it online! (grammatical disaster using the irregular verbs suggested in the challenge)

Arnauld

Posted 2019-09-03T00:33:10.613

Reputation: 111 334

3

Retina, 2051 1891 bytes (UTF-8)

(.+)er$
je $1e0tu $1es0il $1e0elle $1e0nous $1ons0vous $1ez0ils $1ent0elles $1ent0je $1ais0tu $1ais0il $1ait0elle $1ait0nous $1ions0vous $1iez0ils $1aient0elles $1aient0je $1ai0tu $1as0il $1a0elle $1a0nous $1âmes0vous $1âtes0ils $1èrent0elles $1èrent0je $1erai0tu $1eras0il $1era0elle $1era0nous $1erons0vous $1erez0ils $1eront0elles $1eront0je $1erais0tu $1erais0il $1erait0elle $1erait0nous $1erions0vous $1eriez0ils $1eraient0elles $1eraient0je $1e0tu $1es0il $1e0elle $1e0nous $1ions0vous $1iez0ils $1ent0elles $1ent0je $1asse0tu $1asses0il $1ât0elle $1ât0nous $1assions0vous $1assiez0ils $1assent0elles $1assent
(.+i)r$
je $1s0tu $1s0il $1t0elle $1t0nous $1ssons0vous $1ssez0ils $1ssent0elles $1ssent0je $1ssais0tu $1ssais0il $1ssait0elle $1ssait0nous $1ssions0vous $1ssiez0ils $1ssaient0elles $1ssaient0je $1s0tu $1s0il $1t0elle $1t0nous avoîmes0vous avoîtes0ils $1rent0elles $1rent0je $1rai0tu $1ras0il $1ra0elle $1ra0nous $1rons0vous $1rez0ils $1ront0elles $1ront0je $1rais0tu $1rais0il $1rait0elle $1rait0nous $1rions0vous $1riez0ils $1raient0elles $1raient0je $1sse0tu $1sses0il $1sse0elle $1sse0nous $1ssions0vous $1ssiez0ils $1ssent0elles $1ssent0je $1sse0tu $1sses0il avoît0elle avoît0nous $1ssions0vous $1ssiez0ils $1ssent0elles $1ssent
(.+)re$
je $1s0tu $1s0il fai0elle fai0nous $1ons0vous $1ez0ils $1ent0elles $1ent0je $1ais0tu $1ais0il $1ait0elle $1ait0nous $1ions0vous $1iez0ils $1aient0elles $1aient0je $1is0tu $1is0il $1it0elle $1it0nous $1îmes0vous $1îtes0ils $1irent0elles $1irent0je $1rai0tu $1ras0il $1ra0elle $1ra0nous $1rons0vous $1rez0ils $1ront0elles $1ront0je $1rais0tu $1rais0il $1rait0elle $1rait0nous $1rions0vous $1riez0ils $1raient0elles $1raient0je $1e0tu $1es0il $1e0elle $1e0nous $1ions0vous $1iez0ils $1ent0elles $1ent0je $1isse0tu $1isses0il $1ît0elle $1ît0nous $1issions0vous $1issiez0ils $1issent0elles $1issent
je ([aeiouh].+)
j'$1
S`0

To the point implementation. Will try to golf it down from here.

Try it online.

Explanation:

Handle all words ending with er, with a 0 as line separator:

(.+)er$
je $1e0tu $1es0il $1e0elle $1e0nous $1ons0vous $1ez0ils $1ent0elles $1ent0je $1ais0tu $1ais0il $1ait0elle $1ait0nous $1ions0vous $1iez0ils $1aient0elles $1aient0je $1ai0tu $1as0il $1a0elle $1a0nous $1âmes0vous $1âtes0ils $1èrent0elles $1èrent0je $1erai0tu $1eras0il $1era0elle $1era0nous $1erons0vous $1erez0ils $1eront0elles $1eront0je $1erais0tu $1erais0il $1erait0elle $1erait0nous $1erions0vous $1eriez0ils $1eraient0elles $1eraient0je $1e0tu $1es0il $1e0elle $1e0nous $1ions0vous $1iez0ils $1ent0elles $1ent0je $1asse0tu $1asses0il $1ât0elle $1ât0nous $1assions0vous $1assiez0ils $1assent0elles $1assent

Handle all words ending with ir, with 0 as line separator:

(.+i)r$
je $1s0tu $1s0il $1t0elle $1t0nous $1ssons0vous $1ssez0ils $1ssent0elles $1ssent0je $1ssais0tu $1ssais0il $1ssait0elle $1ssait0nous $1ssions0vous $1ssiez0ils $1ssaient0elles $1ssaient0je $1s0tu $1s0il $1t0elle $1t0nous avoîmes0vous avoîtes0ils $1rent0elles $1rent0je $1rai0tu $1ras0il $1ra0elle $1ra0nous $1rons0vous $1rez0ils $1ront0elles $1ront0je $1rais0tu $1rais0il $1rait0elle $1rait0nous $1rions0vous $1riez0ils $1raient0elles $1raient0je $1sse0tu $1sses0il $1sse0elle $1sse0nous $1ssions0vous $1ssiez0ils $1ssent0elles $1ssent0je $1sse0tu $1sses0il avoît0elle avoît0nous $1ssions0vous $1ssiez0ils $1ssent0elles $1ssent

Handle all words ending with re, with 0 as line separator:

(.+)re$
je $1s0tu $1s0il fai0elle fai0nous $1ons0vous $1ez0ils $1ent0elles $1ent0je $1ais0tu $1ais0il $1ait0elle $1ait0nous $1ions0vous $1iez0ils $1aient0elles $1aient0je $1is0tu $1is0il $1it0elle $1it0nous $1îmes0vous $1îtes0ils $1irent0elles $1irent0je $1rai0tu $1ras0il $1ra0elle $1ra0nous $1rons0vous $1rez0ils $1ront0elles $1ront0je $1rais0tu $1rais0il $1rait0elle $1rait0nous $1rions0vous $1riez0ils $1raient0elles $1raient0je $1e0tu $1es0il $1e0elle $1e0nous $1ions0vous $1iez0ils $1ent0elles $1ent0je $1isse0tu $1isses0il $1ît0elle $1ît0nous $1issions0vous $1issiez0ils $1issent0elles $1issent

Replace all je followed by a vowel or 'h' with j':

je ([aeiouh].+)
j'$1

And finally split on zeroes, which basically replaces all 0s with newlines:

S`0

After which the result is output implicitly.

Kevin Cruijssen

Posted 2019-09-03T00:33:10.613

Reputation: 67 575