Exemple #1
0
 //print "Examining {$def->internalRep}\n";
 for ($i = 0; $i < $len; $i++) {
     $c = text_getCharAt($rep, $i);
     if (!text_isUnicodeLetter($prevC) && $c == '-' && $i <= MAX_LEN) {
         $j = $i + 1;
         while (text_isUnicodeLetter(text_getCharAt($rep, $j))) {
             $j++;
         }
         $chunk = mb_substr($rep, $i, $j - $i);
         if ($chunk != '-') {
             $suffix = mb_substr($chunk, 1);
             //print "{$def->id} [{$def->lexicon}] $i [$chunk]\n";
             if ($lexem) {
                 $matchingForm = null;
                 foreach ($inflections as $inflId) {
                     $wls = WordList::loadByLexemIdInflectionId($lexem->id, $inflId);
                     foreach ($wls as $wl) {
                         if (matchesWithAccent($wl->form, $suffix)) {
                             $matchingForm = $wl->form;
                             //print "Matching [{$wl->form}] to [$chunk]\n";
                         }
                     }
                 }
                 if ($matchingForm) {
                     $matchingFormImpl = str_replace($GLOBALS['text_explicitAccent'], $GLOBALS['text_accented'], $matchingForm);
                     // Convert to uppercase when the suffix itself is uppercase
                     if ($suffix == text_unicodeToUpper($suffix)) {
                         $matchingFormImpl = text_unicodeToUpper($matchingFormImpl);
                     }
                     $newRep .= $matchingFormImpl;
                 } else {