p35
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Intent;
|
||||
|
||||
use App\Config\IntentLightConfig;
|
||||
use App\Config\LanguageCleanupConfig;
|
||||
|
||||
/**
|
||||
* IntentLite
|
||||
@@ -20,10 +21,9 @@ final readonly class IntentLite
|
||||
{
|
||||
|
||||
public function __construct(
|
||||
private IntentLightConfig $config
|
||||
)
|
||||
{
|
||||
|
||||
private IntentLightConfig $config,
|
||||
private LanguageCleanupConfig $languageCleanupConfig
|
||||
) {
|
||||
}
|
||||
|
||||
public function detectList(string $originalPrompt): array
|
||||
@@ -99,16 +99,9 @@ final readonly class IntentLite
|
||||
{
|
||||
$s = mb_strtolower($s);
|
||||
|
||||
// Umlaute zusätzlich absichern (falls QueryCleaner das tut)
|
||||
$replacements = [
|
||||
'ä' => 'ae',
|
||||
'ö' => 'oe',
|
||||
'ü' => 'ue',
|
||||
'ß' => 'ss',
|
||||
];
|
||||
|
||||
// Nur als Zusatzform speichern (nicht ersetzen!)
|
||||
foreach ($replacements as $umlaut => $alt) {
|
||||
// Keep the language-specific transliteration table in YAML.
|
||||
// Only append an ASCII variant; do not replace the original form.
|
||||
foreach ($this->languageCleanupConfig->getAsciiTransliterationMap() as $umlaut => $alt) {
|
||||
if (str_contains($s, $umlaut)) {
|
||||
$s .= ' ' . str_replace($umlaut, $alt, $s);
|
||||
break;
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Intent;
|
||||
|
||||
use App\Config\LanguageCleanupConfig;
|
||||
use App\Config\SalesIntentConfig;
|
||||
|
||||
final class SalesIntentLite
|
||||
@@ -16,7 +17,8 @@ final class SalesIntentLite
|
||||
public const ROI = 'roi';
|
||||
|
||||
public function __construct(
|
||||
private readonly SalesIntentConfig $config
|
||||
private readonly SalesIntentConfig $config,
|
||||
private readonly LanguageCleanupConfig $languageCleanupConfig
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -123,11 +125,6 @@ final class SalesIntentLite
|
||||
{
|
||||
$s = mb_strtolower($s);
|
||||
|
||||
return strtr($s, [
|
||||
'ä' => 'ae',
|
||||
'ö' => 'oe',
|
||||
'ü' => 'ue',
|
||||
'ß' => 'ss',
|
||||
]);
|
||||
return $this->languageCleanupConfig->transliterateToAscii($s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user