Ejemplo n.º 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";
}
Ejemplo n.º 2
0
<?php

require_once "../../phplib/util.php";
util_assertModerator(PRIV_EDIT);
util_assertNotMirror();
$reportId = util_getRequestParameter('report');
switch ($reportId) {
    case 'unassociatedLexems':
        echo count(Lexem::loadUnassociated());
        break;
    case 'unassociatedDefinitions':
        echo Definition::countUnassociated();
        break;
    case 'definitionsWithTypos':
        echo Model::factory('Typo')->select('definitionId')->distinct()->count();
        break;
    case 'temporaryDefinitions':
        echo Definition::countByStatus(ST_PENDING);
        break;
    case 'temporaryLexems':
        echo Model::factory('Lexem')->where('modelType', 'T')->count();
        break;
    case 'lexemsWithComments':
        echo Model::factory('Lexem')->where_not_equal('comment', '')->count();
        break;
    case 'lexemsWithoutAccents':
        echo Model::factory('Lexem')->where_raw("form not rlike '\\''")->where('noAccent', false)->count();
        break;
    case 'wotd':
        echo Model::factory('WordOfTheDay')->count();
        break;
<?php

require_once "../../phplib/util.php";
util_assertModerator(PRIV_EDIT);
util_assertNotMirror();
RecentLink::createOrUpdate('Lexeme neasociate');
$lexems = Lexem::loadUnassociated();
SmartyWrap::assign('lexems', $lexems);
SmartyWrap::assign('sectionTitle', 'Lexeme neasociate');
SmartyWrap::assign('sectionCount', count($lexems));
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::displayAdminPage('admin/lexemList.ihtml');