Fix identity subject extraction to handle punctuation in questions
This commit is contained in:
+1
-1
@@ -347,7 +347,7 @@ function sanitizeSubject(value: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function extractIdentitySubject(normalizedQuery: string): string {
|
function extractIdentitySubject(normalizedQuery: string): string {
|
||||||
const match = normalizedQuery.match(/\b(?:who\s+(?:is|was)|tell me about)\s+([a-z][a-z\s'-]{1,40})$/i)
|
const match = normalizedQuery.match(/\b(?:who\s+(?:is|was)|tell me about)\s+([a-z][a-z\s'-]{1,40})\b/i)
|
||||||
if (!match) return ''
|
if (!match) return ''
|
||||||
const cleaned = sanitizeSubject(match[1])
|
const cleaned = sanitizeSubject(match[1])
|
||||||
const withoutArticles = cleaned.replace(/^(a|an|the)\s+/, '').trim()
|
const withoutArticles = cleaned.replace(/^(a|an|the)\s+/, '').trim()
|
||||||
|
|||||||
Reference in New Issue
Block a user