} $wls = WordList::loadByLexemId($lexem->id); $ignore = false; for ($i = 0; $i < count($wls) && !$ignore; $i++) { $ignore = ord($wls[$i]->form) == 0 || text_contains($wls[$i]->form, "'"); } if ($ignore) { print " Ignoring lexem " . $lexem->id . " (" . $lexem->unaccented . "): paradigm contains accents or null characters\n"; } if (!$ignore) { if (!count($transfMap)) { // Create model_descriptions by comparing the first lexem to its // existing wordlists. print " Using lexem '" . $lexem->unaccented . "' as exponent\n"; foreach ($wls as $wl) { $transforms = text_extractTransforms($lexem->unaccented, $wl->form); $transfMap[$wl->inflectionId] = $transforms; } // Dump the transformation table print " Transforms:\n"; foreach ($transfMap as $inflId => $transforms) { print " {$inflId}:"; foreach ($transforms as $t) { print " [" . $t->from . ']->[' . $t->to . ']'; } print "\n"; } } // Now generate the paradigm for the lexem and compare it to the // existing wordlists. foreach ($wls as $wl) {
$inflId = $row['infl_id']; $isBaseForm = $row['is_baseform']; if ($baseForm && $isBaseForm) { die("Incorrect baseform for {$model->modelType}{$model->number}\n"); } if (!$baseForm) { $baseForm = $form; } if (text_contains($baseForm, "'") ^ text_contains($form, "'")) { print "Incomplete accents for {$baseForm} => {$form}\n"; } //print "$baseForm=>$form\n"; if (!text_validateAlphabet($form, "aăâbcdefghiîjklmnopqrsștțuvwxyz'")) { die("Illegal characters in form {$form}\n"); } $transforms = text_extractTransforms($baseForm, $form, $model->modelType == 'P'); assert(count($transforms) >= 2); // Split off the last transform: it indicates the accent shift $accentShift = array_pop($transforms); if ($accentShift != UNKNOWN_ACCENT_SHIFT && $accentShift != NO_ACCENT_SHIFT) { $accentedVowel = array_pop($transforms); } else { $accentedVowel = ''; } //foreach ($transforms as $t) { // print $t->toString() . ' '; //} //print "$accentShift\n"; // Reverse the transforms array. At the same time, save the transforms. $newT = array(); for ($i = count($transforms) - 1; $i >= 0; $i--) {