Skip to content

Instantly share code, notes, and snippets.

@nautilebleu
Last active August 29, 2015 14:07
Show Gist options
  • Save nautilebleu/6a0993f0d3878f71240e to your computer and use it in GitHub Desktop.
Save nautilebleu/6a0993f0d3878f71240e to your computer and use it in GitHub Desktop.
Apprendre le code (et aussi l'orthographe !)
def donne_le_pluriel(nom):
si nom.finit_par('x') ou nom.finit_par('z'):
retourne nom
sinon si nom.finit_par('al'):
retourne nom[:-2] + 'aux'
sinon si nom.finit_par('ail'):
retourne nom[:-3] + 'aux'
sinon si nom.finit_par('ou'):
si nom.dans(['bijou', 'caillou', 'chou', 'genou', 'hibou', 'joujou', 'pou', 'ripou']):
retourne nom + 'x'
sinon:
retourne nom + 's'
sinon si nom.finit_par('eu') ou nom.finit_par('eau') ou nom.finit_par('au'):
retourne nom + 'x'
sinon si nom.dans(['ail', 'ciel', 'œil']):
si nom == 'ail':
retourne 'aulx'
si nom == 'ciel':
retourne 'cieux'
si nom == 'œil':
retourne 'yeux'
retourne nom + 's'
@pquentin
Copy link

pquentin commented Oct 3, 2014

Plus qu'à repasser en Python et écrire des tests avec les pluriels dans le Wiktionnaire (exemple : pluriel -> pluriels http://fr.wiktionary.org/wiki/pluriel) :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment