echo "Bad id: {$id}\n"; continue; } $definition = Definition::load($id); $words = Word::loadByDefinitionId($id); $nameExists = false; foreach ($words as $word) { if (strtolower($word->name) == $name) { $nameExists = true; } } if (!$nameExists) { echo "Name does not match id: {$name}, {$id}"; continue; } $dnames = Word::joinCommaSeparatedDnames($words); echo "Adding words for {$id} ({$dnames})\n"; $latinNames = split('\\|', $latinList); foreach ($latinNames as $latinName) { $latinName = trim($latinName); // Split into words. If multiple words, add each individual word AND the // name as a whole. $latinWords = split(' ', $latinName); $numWords = count($latinWords); for ($i = 0; $i < $numWords; $i++) { $latinWords[$i] = trim($latinWords[$i]); } if ($numWords > 1) { $latinWords[] = implode('', $latinWords); } foreach ($latinWords as $latinWord) {