function importLexems($srcId, $srcName) { $dbResult = db_execute("select l.*, d.internalRep from Lexem l, LexemDefinitionMap ldm, Definition d where l.id = ldm.lexemId and ldm.definitionId = d.id " . "and d.status = 0 and d.sourceId = {$srcId} and not l.isLoc order by l.formNoAccent"); $rowCount = $dbResult->RowCount(); print "************** Import {$rowCount} lexeme din {$srcName}\n"; while (!$dbResult->EOF) { $internalRep = $dbResult->fields['internalRep']; unset($dbResult->fields['internalRep']); unset($dbResult->fields['16']); $l = new Lexem(); $l->set($dbResult->fields); $dbResult->MoveNext(); print sprintf("%d\t%-20s\t%-60s\t%-50s\n", $l->id, $l->formNoAccent, mb_substr($internalRep, 0, 58), "http://dexonline.ro/lexem/{$l->formNoAccent}/{$l->id}"); $l->isLoc = 1; $l->save(); } }
$i++; } if (!$hasGoodSourceIds) { $isDerivative = false; // Check if the lexem is a long infinitive or a participle $verbQuery = "select distinct Lexem.* from Lexem, InflectedForm where Lexem.id = InflectedForm.lexemId and Lexem.isLoc " . "and InflectedForm.formNoAccent = '{$l->formNoAccent}' and InflectedForm.inflectionId in (50, 52)"; $verbs = db_getObjects(new Lexem(), db_execute($verbQuery)); if (count($verbs) && $l->modelType == 'F' && ($l->modelNumber == '107' || $l->modelNumber == '113')) { $isDerivative = true; // Long infinitive } else { foreach ($verbs as $verb) { $pm = ParticipleModel::loadByVerbModel($verb->modelNumber); if ($l->modelType == 'A' && $l->modelNumber == $pm->adjectiveModel) { $isDerivative = true; // Participle } } } if (!$isDerivative) { // Clear the isLoc bit print "http://dexonline.ro/lexem/{$l->formNoAccent}/{$l->id}"; if (count($verbs)) { print " [omonim]"; } print "\n"; $l->isLoc = false; $l->save(); } } }