From: Florent Bruneau Date: Thu, 27 Mar 2008 19:54:16 +0000 (+0100) Subject: Update soundex algorithm using comments from users [0]. X-Git-Tag: xorg/0.9.16~47 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=33a55e8d5a9ad9d6d92fe66b6e52c9ea1149639a;p=platal.git Update soundex algorithm using comments from users [0]. [0] http://blog.mymind.fr/post/2007/03/15/Soundex-Francais Signed-off-by: Florent Bruneau --- diff --git a/include/xorg.misc.inc.php b/include/xorg.misc.inc.php index 86c9fc9..6447ddb 100644 --- a/include/xorg.misc.inc.php +++ b/include/xorg.misc.inc.php @@ -155,12 +155,14 @@ function soundex_fr($sIn) static $convVIn, $convVOut, $convGuIn, $convGuOut, $accents; if (!isset($convGuIn)) { global $uc_convert, $lc_convert; - $convGuIn = array( 'GUI', 'GUE', 'GA', 'GO', 'GU', 'SC', 'CA', 'CO', 'CU', 'QU', 'Q', 'CC', 'CK', 'G', 'ST', 'PH'); - $convGuOut = array( 'KI', 'KE', 'KA', 'KO', 'KU', 'SK', 'KA', 'KO', 'KU', 'K', 'K', 'K', 'K', 'J', 'T', 'F'); + $convGuIn = array( 'GUI', 'GUE', 'GA', 'GO', 'GU', 'SCI', 'SCE', 'SC', 'CA', 'CO', + 'CU', 'QU', 'Q', 'CC', 'CK', 'G', 'ST', 'PH'); + $convGuOut = array( 'KI', 'KE', 'KA', 'KO', 'K', 'SI', 'SE', 'SK', 'KA', 'KO', + 'KU', 'K', 'K', 'K', 'K', 'J', 'T', 'F'); $convVIn = array( '/E?(AU)/', '/([EA])?[UI]([NM])([^EAIOUY]|$)/', '/[AE]O?[NM]([^AEIOUY]|$)/', '/[EA][IY]([NM]?[^NM]|$)/', '/(^|[^OEUIA])(OEU|OE|EU)([^OEUIA]|$)/', '/OI/', '/(ILLE?|I)/', '/O(U|W)/', '/O[NM]($|[^EAOUIY])/', '/(SC|S|C)H/', - '/([^AEIOUY1])[^AEIOUYLKTP]([UAO])([^AEIOUY])/', '/([^AEIOUY]|^)([AUO])[^AEIOUYLKTP]([^AEIOUY1])/', '/^KN/', + '/([^AEIOUY1])[^AEIOUYLKTPNR]([UAO])([^AEIOUY])/', '/([^AEIOUY]|^)([AUO])[^AEIOUYLKTP]([^AEIOUY1])/', '/^KN/', '/^PF/', '/C([^AEIOUY]|$)/', '/C/', '/Z$/', '/(?