Check strongs_numbers (lemma) on import to make sure it is formatted as expected

This commit is contained in:
Leonard Smith 2020-10-07 11:07:21 -05:00
parent 40f408115d
commit c6d43527e7
2 changed files with 13 additions and 2 deletions

View File

@ -37,7 +37,7 @@ class LexiconEntryImportHandler
while (($item = readdir($handle)) !== false) {
if ((substr($item, 0, 1) === 'g') && is_file($dir . '/' . $item)) {
$parts = explode('.', substr($item, 1));
$this->importEntryFile($dir . '/' . $item, $parts[0]);
$this->importEntryFile($dir . '/' . $item, 'G' . $parts[0]);
}
}

View File

@ -137,12 +137,23 @@ class UlbXmlImportHandler
'lemma' => $wordElem->getAttribute('lexeme'),
'morph' => $wordElem->getAttribute('morph'),
'ognt_sort' => $ognt_sort,
'strongs_number' => $wordElem->getAttribute('lemma'),
'strongs_number' => $this->formatStrongsNumber($wordElem->getAttribute('lemma')),
]);
return $word;
}
/**
* Not all of the strongs numbers coming from the XML files are formatted the same. Let's fix that here.
*
* @param string $strongsNumber
* @return string
*/
protected function formatStrongsNumber(string $strongsNumber)
{
return 'G' . ltrim($strongsNumber, "Gg");
}
/**
* @param DOMElement $chapterElem
* @return string