예제 #1
0
<?php

require_once '../../phplib/util.php';
assert_options(ASSERT_BAIL, 1);
debug_off();
$dbResult = mysql_query("select * from lexems where lexem_id not in " . "(select LexemId from LexemDefinitionMap, Definition " . "where DefinitionId = Definition.Id " . "and SourceId not in (6, 8) and Status = 0)");
$seen = 0;
$split = 0;
while (($dbRow = mysql_fetch_assoc($dbResult)) != null) {
    $l = Lexem::createFromDbRow($dbRow);
    $defs = Definition::loadByLexemId($l->id);
    if (!count($defs)) {
        continue;
    }
    $seen++;
    // Remove the -ul accent where possible.
    if (text_endsWith($l->form, 'ul')) {
        $form = substr($l->form, 0, strlen($l->form) - 2);
        $otherLexems = Lexem::loadByForm($form);
        if (count($otherLexems)) {
            print "REMOVING -UL FROM: {$l->form}\n";
            foreach ($otherLexems as $otherLexem) {
                foreach ($defs as $def) {
                    LexemDefinitionMap::associate($otherLexem->id, $def->id);
                }
            }
            $l->delete();
            $split++;
            continue;
        }
    }
예제 #2
0
<?php

require_once '../../phplib/util.php';
$PLURAL_INFLECTIONS = array(3, 11, 19, 27, 35);
$SOURCES = loadSources();
define('DRY_RUN', true);
$dbResult = mysql_query('select * from lexems where (lexem_model_type = "T") or (lexem_model_type in ("MQ", "FQ", "NQ") and lexem_restriction like "%P%")' . 'order by lexem_neaccentuat');
$found = 0;
while ($row = mysql_fetch_assoc($dbResult)) {
    $lexem = Lexem::createFromDbRow($row);
    $wordLists = WordList::loadByUnaccented($lexem->unaccented);
    $matchingWordLists = array();
    foreach ($wordLists as $wl) {
        if (in_array($wl->inflectionId, $PLURAL_INFLECTIONS) && $wl->lexemId != $lexem->id) {
            $matchingWordLists[] = $wl;
        }
    }
    if (count($matchingWordLists)) {
        $sources = getSourcesForLexem($lexem);
        print "{$lexem->unaccented} {$lexem->modelType}{$lexem->modelNumber}{$lexem->restriction} {$sources} " . "http://dexonline.ro/admin/lexemEdit.php?lexemId={$lexem->id}\n";
        foreach ($matchingWordLists as $wl) {
            $match = Lexem::load($wl->lexemId);
            $sources = getSourcesForLexem($match);
            print "    * {$match->unaccented} {$match->modelType}{$match->modelNumber}{$match->restriction} {$sources}" . "http://dexonline.ro/admin/lexemEdit.php?lexemId={$match->id}\n";
        }
        $found++;
    }
}
print "{$found} lexeme semnalate.\n";
/**************************************************************/
function loadSources()