Example #1
0
function associateLongInfinitivesAndParticiples()
{
    $lexems = Lexem::loadUnassociated();
    $numMatched = 0;
    foreach ($lexems as $l) {
        $matched = false;
        $wordlist = WordList::loadByUnaccented($l->unaccented);
        foreach ($wordlist as $wl) {
            if ($wl->inflectionId == 50 || $wl->inflectionId == 52) {
                $verb = Lexem::load($wl->lexemId);
                print "{$l->unaccented} :: {$verb->unaccented}\n";
                $matched = true;
                $ldms = LexemDefinitionMap::loadByLexemId($verb->id);
                foreach ($ldms as $ldm) {
                    $existingLdm = LexemDefinitionMap::load($l->id, $ldm->definitionId);
                    if (!$existingLdm) {
                        $newLdm = LexemDefinitionMap::create($l->id, $ldm->definitionId);
                        $newLdm->save();
                    }
                }
            }
        }
        if ($matched) {
            $numMatched++;
        }
    }
    print "Matched {$numMatched} of " . count($lexems) . " total lexems.\n";
}
Example #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()