require_once "../../phplib/util.php"; assert_options(ASSERT_BAIL, 1); debug_off(); $dbResult = mysql_query('select * from lexems ' . 'where lexem_forma not rlike "\'" '); $seen = 0; $fixed = 0; while ($dbRow = mysql_fetch_assoc($dbResult)) { $lexem = Lexem::createFromDbRow($dbRow); // print $lexem->form . "\n"; $defs = Definition::loadByLexemId($lexem->id); // Phase 2: // - Lexems with only one vowel // - Paticiples (extra -T at the end, type A2) // - Long infinitves (extra -RE at the end, type F107/F113). $vowelCount = text_countVowels($lexem->form); if ($vowelCount == 1) { $lexem->form = text_placeAccent($lexem->form, 1, null); //print "{$lexem->form}\n"; $lexem->save(); $lexem->regenerateParadigm(); $fixed++; $seen++; continue; } $position = false; $form = false; foreach ($defs as $def) { $accented = _text_extractLexiconHelper($def); $accented = internalizeLexicon($accented); $accentCount = mb_substr_count($accented, "'");
<?php require_once "../../phplib/util.php"; assert_options(ASSERT_BAIL, 1); debug_off(); $count = 0; $fixed = 0; $dbResult = mysql_query('select * from lexems ' . 'where lexem_forma not rlike "\'"'); print "Adding accents to lexems with a single vowel.\n"; print "Examining " . mysql_num_rows($dbResult) . " lexems.\n"; while ($dbRow = mysql_fetch_assoc($dbResult)) { $l = Lexem::createFromDbRow($dbRow); if (text_countVowels($l->form) == 1) { $l->form = text_placeAccent($l->form, 1, ''); $l->save(); //print "Fixed: {$l->form}\n"; $fixed++; } $count++; } print "{$count} lexems seen, {$fixed} fixed.\n";