Le Dimanche 1 Septembre 2002 00:21, Guillaume Rousse a écrit :
The following method, loosely adapted from quant(), allows to deal with
article variation in front of substantives beginning with a,e,i,o,u,y
letters ('voyelles' in french), a phenomenon called 'elision', such as
le/l' in french. In english there also the a/an case. Maybe it would be
useful for inclusion in Maketext ?
Actually, i've created several of such utilitiy function to deal with all
those french language subtilities. See attached file for code.
The goal is to be able to have correct output for such phrases:
"voulez-vous créer un nouveau X", where X is a noun of unknown gender and
first letter.
This is done this way:
"voulez vous créer un " . $lh->accord(
$lh->gender($noun),
male => $lh->liaison($noun, 'nouveau ', 'nouvel '),
female => 'nouvelle ' . $noun
);
Résult:
voulez-vous créer un nouveau livre ?
voulez-vous créer un nouvel auteur ?
voulez-vous créer une nouvelle édition ?
I've tried to be as much generic as possible, so as to be usable in other
languages: the accord/gender functions could also be used for selecting
between his/her in english,
$lh->accord(
$lh->gender($owner),
male => 'his',
female => 'her'
);
or for language with more than two genders as german
$lh->accord(
$lh->gender($noun),
male => 'ein',
female => 'eine',
neutral => 'ein'
);
I'd like to have output of other people, especially Sean M. Burke, on the
usability/interest of this code. Maybe i'm just taking the wrong way, after
all.
--
Guillaume Rousse <rousse(_at_)ccr(_dot_)jussieu(_dot_)fr>
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html