Kometen-Ereignisse im Monatsfließtext als vollständige Saetze formulieren
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+25
-13
@@ -1614,20 +1614,31 @@ if (!function_exists('monthForecastBuildNarrativeText')) {
|
|||||||
static fn (array $event): bool => in_array((string) ($event['type'] ?? ''), ['favorite_comet_good_visibility', 'favorite_comet_perihelion', 'favorite_comet_geocentric_minimum'], true),
|
static fn (array $event): bool => in_array((string) ($event['type'] ?? ''), ['favorite_comet_good_visibility', 'favorite_comet_perihelion', 'favorite_comet_geocentric_minimum'], true),
|
||||||
4
|
4
|
||||||
);
|
);
|
||||||
if ($cometEvents !== []) {
|
$describeCometEvent = static function (array $event): ?string {
|
||||||
|
$name = trim((string) ($event['comet_name'] ?? ''));
|
||||||
|
$date = trim((string) ($event['date'] ?? ''));
|
||||||
|
if ($name === '' || $date === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return match ((string) ($event['type'] ?? '')) {
|
||||||
|
'favorite_comet_perihelion' => "Der Komet {$name} erreicht am {$date} seinen sonnennächsten Bahnpunkt, das Perihel.",
|
||||||
|
'favorite_comet_geocentric_minimum' => "Der Komet {$name} kommt der Erde am {$date} am nächsten.",
|
||||||
|
'favorite_comet_good_visibility' => "Der Komet {$name} ist ab dem {$date} besonders gut zu beobachten.",
|
||||||
|
default => null,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
$cometSentences = array_values(array_filter(array_map($describeCometEvent, $cometEvents)));
|
||||||
|
|
||||||
|
if ($cometSentences !== []) {
|
||||||
$cometIntro = $seededPick([
|
$cometIntro = $seededPick([
|
||||||
'Bei den Kometen sind in diesem Monat besonders',
|
'Auch bei den Kometen gibt es in diesem Monat einiges zu entdecken.',
|
||||||
'Auch bei den Kometen lohnt sich in diesem Monat der Blick auf',
|
'Kometenfreunde kommen in diesem Monat ebenfalls auf ihre Kosten.',
|
||||||
'Unter den Kometen fallen in diesem Monat vor allem',
|
'Unter den Kometen gibt es in diesem Monat lohnende Ziele.',
|
||||||
'Kometenfreunde können sich in diesem Monat besonders für',
|
'Auch der Blick auf die Kometen lohnt sich in diesem Monat.',
|
||||||
], 'cometIntro', 'Bei den Kometen sind in diesem Monat besonders');
|
], 'cometIntro', 'Auch bei den Kometen gibt es in diesem Monat einiges zu entdecken.');
|
||||||
$cometOutro = $seededPick([
|
$addParagraph($cometIntro . ' ' . implode(' ', $cometSentences));
|
||||||
'interessant.',
|
|
||||||
'beobachtenswert.',
|
|
||||||
'bemerkenswert.',
|
|
||||||
'einen genaueren Blick wert.',
|
|
||||||
], 'cometOutro', 'interessant.');
|
|
||||||
$addParagraph($cometIntro . ' ' . $describeEvents($cometEvents) . ' ' . $cometOutro);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$eclipseEvents = $findEvents(
|
$eclipseEvents = $findEvents(
|
||||||
@@ -2993,6 +3004,7 @@ foreach ($favoriteCometEvents as $favoriteCometEvent) {
|
|||||||
'end_local_iso' => (string) ($favoriteCometEvent['end_local_iso'] ?? ''),
|
'end_local_iso' => (string) ($favoriteCometEvent['end_local_iso'] ?? ''),
|
||||||
'duration_minutes' => isset($favoriteCometEvent['duration_minutes']) ? (int) $favoriteCometEvent['duration_minutes'] : null,
|
'duration_minutes' => isset($favoriteCometEvent['duration_minutes']) ? (int) $favoriteCometEvent['duration_minutes'] : null,
|
||||||
'type' => $favoriteCometType,
|
'type' => $favoriteCometType,
|
||||||
|
'comet_name' => trim((string) ($favoriteCometEvent['comet_name'] ?? '')),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user