Identify uncertainty before brackets ("Berlin ? (Germany)" > "Berlin

(Germany)" + Uncertain)
This commit is contained in:
2024-11-09 18:42:18 +01:00
parent 7cfe752c94
commit 48355a6a36
2 changed files with 79 additions and 61 deletions

View File

@ -328,6 +328,14 @@ final class NodaUncertaintyHelper {
}
}
// If brackets are included in the name, try removing prefixes and suffixes
// from the beginning.
if (($bracketPos = strpos($ort_name, "(")) !== false) {
$start = substr($ort_name, 0, $bracketPos);
$end = substr($ort_name, $bracketPos);
$ort_name = self::cleanUncertaintyIndicatorsPlace($start) . ' ' . $end;
}
return self::trim($ort_name);
}
@ -358,6 +366,13 @@ final class NodaUncertaintyHelper {
}
}
// If brackets are included in the name, try the same for everything up to the
// first brackets.
if (($bracketPos = strpos($ort_name, "(")) !== false) {
$name = substr($ort_name, 0, $bracketPos);
return self::guessPlaceCertainty($name);
}
return true; // Certain / no uncertainty found
}