fix(amazon-shopping): enforce rating filters in chat output
This commit is contained in:
@@ -4,6 +4,9 @@ function cleanQuery(text: string): string {
|
||||
return text
|
||||
.replace(/\breview score of\b/gi, " ")
|
||||
.replace(/\brating of\b/gi, " ")
|
||||
.replace(/\b(?:delivery|shipping)\s+only\b/gi, " ")
|
||||
.replace(/\blow\s+to\s+high\b/gi, " ")
|
||||
.replace(/\bhigh\s+to\s+low\b/gi, " ")
|
||||
.replace(/\bof\s+in\s+width\b/gi, " ")
|
||||
.replace(/\bin\s+width\b/gi, " ")
|
||||
.replace(/\b(?:that|and|with|have)\b/gi, " ")
|
||||
@@ -89,7 +92,7 @@ export function parseNaturalLanguageRequest(input: string): ParsedNaturalLanguag
|
||||
}
|
||||
|
||||
const exclusiveRating = remaining.match(/\b(?:a\s+)?(?:(?:review score|rating)\s+of\s+|rating\s+)?(?:more than|over|above|rated above)\s+([0-5](?:\.[0-9])?)\s*(?:stars?)?\b/i);
|
||||
const inclusiveRating = remaining.match(/\b(?:review score|rating)\s+of\s+([0-5](?:\.[0-9])?)\s*(?:stars?)?\s+(?:or|and)\s+(?:higher|better)\b/i)
|
||||
const inclusiveRating = remaining.match(/\b(?:a\s+)?(?:review score|rating)(?:\s+of)?\s+([0-5](?:\.[0-9])?)\s*(?:stars?)?\s+(?:or|and)\s+(?:higher|better)\b/i)
|
||||
?? remaining.match(/\b([0-5](?:\.[0-9])?)\s*stars?\s+or\s+better\b/i)
|
||||
?? remaining.match(/\b([0-5](?:\.[0-9])?)\s*stars?\s+(?:or|and)\s+(?:higher|better)\b/i)
|
||||
?? remaining.match(/\b(?:at least|minimum|min\.?)\s+([0-5](?:\.[0-9])?)\s*(?:stars?|rating)?\b/i);
|
||||
|
||||
Reference in New Issue
Block a user