Fix defaults for length units, add weight unit concordance list

This commit is contained in:
Joshua Ramon Enslin 2023-10-17 00:35:50 +02:00
parent 1b505437a4
commit 2d96e94d6d
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
2 changed files with 60 additions and 20 deletions

View File

@ -12,26 +12,31 @@ declare(strict_types = 1);
final class MDConcLengths implements MDImporterConcordanceListInterface {
private const LENGTHS_LIST = [
"cn" => "cm",
",cm" => "cm",
"5cm" => "cm",
"ca" => "cm", // Default: cm; This is likely also a typo
"Breite" => "cm", // Default: cm
"breite" => "cm", // Default: cm
"Width" => "cm", // Default: cm
"width" => "cm", // Default: cm
"Höhe" => "cm", // Default: cm
"höhe" => "cm", // Default: cm
"Height" => "cm", // Default: cm
"height" => "cm", // Default: cm
"´´´" => "cm", // Default: cm
"Theater" => "cm", // Default: cm
"Oper" => "cm", // Default: cm
"min" => "cm", // Default: cm
"-" => "cm", // Default: cm
"a)" => "cm", // Default: cm
"/" => "cm", // Default: cm
"geöffnet" => "cm", // Default: cm
// Default: Empty
"Breite" => "",
"breite" => "",
"Width" => "",
"width" => "",
"Höhe" => "",
"höhe" => "",
"Height" => "",
"height" => "",
"´´´" => "",
"Theater" => "",
"Oper" => "",
"min" => "",
"-" => "",
"a)" => "",
"/" => "",
"geöffnet" => "",
// cm
"cn" => "cm",
",cm" => "cm",
"5cm" => "cm",
"Zentimeter" => "cm",
"ca" => "cm", // This is likely a typo
"Meter" => "m",
"Meters" => "m",

35
src/MDConcWeights.php Normal file
View File

@ -0,0 +1,35 @@
<?PHP
/**
* Constains lists for categorizing misspelled weight units.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Provides lists for categorizing misspelled sizes.
*/
final class MDConcWeights implements MDImporterConcordanceListInterface {
private const WEIGHTS_LIST = [
"cm" => "", // Default
"Gramm" => "g",
];
/**
* Require a function for getting the concordance target.
*
* @param string $input Input string.
*
* @return string
*/
public static function getConcordanceTarget(string $input):string {
if (!isset(self::WEIGHTS_LIST[$input])) {
throw new MDImporterMissingConcordance("Unknown weight type: " . $input);
}
return self::WEIGHTS_LIST[$input];
}
}