Deploy on 2026-06-05 17:03:37

This commit is contained in:
Hamza-Ayed
2026-06-05 17:03:37 +03:00
parent 89b72a0b42
commit 227fd7c412
3 changed files with 62 additions and 18 deletions

View File

@@ -158,6 +158,25 @@ PROMPT;
$score = 30;
$tags = [];
$isOpportunity = true; // Treat all entries as opportunities by default
$orgName = null;
$country = null;
// Smart Regex rules for extracting organization names from title
if (preg_match('/^([A-Z0-9][A-Za-z0-9\s\-\.\&]{2,40})\s+(raises|launches|secures|gets|partners|funded|acquires|announces|closes|receives|seeks)\b/i', $title, $matches)) {
$orgName = trim($matches[1]);
} elseif (preg_match('/(backs|invests in|funds|acquires)\s+([A-Z0-9][A-Za-z0-9\s\-\.\&]{2,40})/i', $title, $matches)) {
$orgName = trim($matches[2]);
} elseif (preg_match('/(investment in|funding for|launch of)\s+([A-Z0-9][A-Za-z0-9\s\-\.\&]{2,40})/i', $title, $matches)) {
$orgName = trim($matches[2]);
}
if ($orgName) {
$orgName = preg_replace('/\b(series|seed|funding|round|raised|million|billion|capital|partners|ventures|inc|ltd|corp|co|llc)\b.*$/i', '', $orgName);
$orgName = trim($orgName, " \t\n\r\0\x0B,.-");
if (strlen($orgName) < 2 || in_array(strtolower($orgName), ['startup', 'founder', 'investor', 'program', 'new', 'why', 'how', 'what', 'who', 'the'])) {
$orgName = null;
}
}
// Keyword patterns
if (preg_match('/\b(grant|funding|award|prize)\b/i', $text)) {
@@ -238,8 +257,8 @@ PROMPT;
'tags' => $tags,
'is_opportunity' => $isOpportunity,
'summary' => substr($description, 0, 200),
'organization_name' => null,
'country' => null,
'organization_name' => $orgName,
'country' => $country,
];
}
}