MDImporterConcordanceLists/src/MDConcLengths.php

76 lines
1.8 KiB
PHP
Raw Normal View History

<?PHP
/**
* Constains lists for categorizing misspelled sizes.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Provides lists for categorizing misspelled sizes.
*/
final class MDConcLengths implements MDImporterConcordanceListInterface {
private const LENGTHS_LIST = [
// Default: Empty
"Breite" => "",
"breite" => "",
"Width" => "",
"width" => "",
"Höhe" => "",
"höhe" => "",
"Height" => "",
"height" => "",
"´´´" => "",
"Theater" => "",
"Oper" => "",
"min" => "",
"-" => "",
"a)" => "",
"/" => "",
"geöffnet" => "",
2023-10-17 15:50:35 +02:00
"Scheibe" => "",
"Trageöse" => "",
// cm
"cn" => "cm",
",cm" => "cm",
"5cm" => "cm",
"Zentimeter" => "cm",
"ca" => "cm", // This is likely a typo
2023-10-16 22:39:16 +02:00
"Meter" => "m",
"Meters" => "m",
"meter" => "m",
"meters" => "m",
"Milimeter" => "mm",
"Milimeters" => "mm",
"Millimeter" => "mm",
"Millimeters" => "mm",
2023-10-17 15:50:35 +02:00
"ma" => "mm", // Either a typo for mm, or miliamper?
2022-09-02 02:10:36 +02:00
"inch" => "in",
"Zoll" => "in",
"zoll" => "in",
];
/**
* 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::LENGTHS_LIST[$input])) {
throw new MDImporterMissingConcordance("Unknown length type: " . $input);
}
return self::LENGTHS_LIST[$input];
}
}