Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Add invariable words in french #199

Open
wants to merge 1 commit into
base: 2.0.x
Choose a base branch
from

Conversation

lemonlab
Copy link

@lemonlab lemonlab commented Jun 26, 2022

@greg0ire i have retargeted to 2.0.x as you suggest here : #198


Some words should not be singularized in french.

The list is coming from here : https://github.com/symfony/symfony/blob/6.2/src/Symfony/Component/String/Inflector/FrenchInflector.php#L111

@greg0ire
Copy link
Member

@lemonlab great! You didn't have to create a new PR though, using the edit button to change the target branch would have worked just as well. For next time 😉

yield new Pattern('abus');
yield new Pattern('albatros');
yield new Pattern('anchois');
yield new Pattern('anglais');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this would make the list a lot longer but why not "danois", "hollandais", etc. etc.? @Alexandre-T hi! Maybe you would know since you contributed the original list to Symfony?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. I think Symfony would also approve such list.

@Alexandre-T
Copy link

I think that creating a list of all "gentilés" is too long, so it could more useful to implement the grammatical rule ais and ois 'gentilés" aren't singularised. Technicaly, you have to implement an exception list of this exception rule.
If a word is finishing by ais, do not singularize it except balai, etc.
if a word is finishing by ois, do not singularize it except roi, etc.

Je me permets de l'écrire en français vu les contributeurs :-) : la liste des gentilés qui finissent par ais et ois est particulièrement longue (il ya quand même 36.000 communes en France (je vous passe les bordelais, strabourgeois, etc.) et on se retrouverait à télécharger une liste particulièrement longue). A constituer aussi, une telle liste demanderait du temps. (Et je ne vous raconte pas la liste de Pull Request à gérer quand chaque villageois (exception aussi) voudra comme moi ajouter son gentilé (je suis très fier d'être canaulais, alors je l'ajoute ?)

Donc je pense qu'il est peut-être plus simple de prendre le problème à l'envers :
créer une exception pour ne pas singulariser les mots finissant en ais ou en ois.

Ensuite, avec un dictionnaire inversé (ce que j'ai utilisé pour Symfony), on recherche les noms communs finissant par ai et oi au singulier et on les gère comme exception de l'exception précédente.

Pour les tests, on peut prendre ces valeurs :

canaulais => canaulais
français => français
portois => portois
balais => balai
rois => roi

Liste des mots en oi :
émoi
surmoi
monoï
tournoi
waterzooi
époi
roi
paroi
beffroi
orfroi
arroi
charroi
désarroi

Liste des mots en ai
thaï
cabiai
haikai
tokai
skai
lai
balai
délai
déblai
remblai
virelai
mai
shahnai
moai

@greg0ire
Copy link
Member

greg0ire commented Jun 28, 2022

@Alexandre-T merci pour le plan d'attaque, ça semble faisable avec ce genre de regex: https://regex101.com/r/ZXXbpJ/1

@lemonlab soit tu te sens d'implémenter ça, soit non, et dans le deux cas, peux-tu retirer "anglais" de ton premier commit, (avec git commit --amend && git push --force) ?

@Alexandre-T
Copy link

Alexandre-T commented Jun 28, 2022

Je ne sais pas ce qui est plus rapide, deux boucles ou bien une regexp plus complexe, mais en tout cas, celle-ci gère les deux :
^(?!balais|délais|rois)(.*ais|.*ois)$
https://regex101.com/r/ZXXbpJ/2

@greg0ire
Copy link
Member

ping @lemonlab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants