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"; }