Spaces:
Sleeping
Sleeping
app.py
CHANGED
|
@@ -45,6 +45,7 @@ def emphasize_keywords(text, keywords, repeat=3):
|
|
| 45 |
def clean_text(input_text):
|
| 46 |
cleaned = re.sub(r"[^A-Za-z0-9\s]", " ", input_text)
|
| 47 |
cleaned = re.sub(r"\b[A-Za-z]{2,}[0-9]{3,}\b", "", cleaned) # SKU/product code pattern (letters followed by numbers)
|
|
|
|
| 48 |
|
| 49 |
# Example keyword list
|
| 50 |
keywords = ["blazer", "shirt", "trouser", "saree", "tie", "suit"]
|
|
|
|
| 45 |
def clean_text(input_text):
|
| 46 |
cleaned = re.sub(r"[^A-Za-z0-9\s]", " ", input_text)
|
| 47 |
cleaned = re.sub(r"\b[A-Za-z]{2,}[0-9]{3,}\b", "", cleaned) # SKU/product code pattern (letters followed by numbers)
|
| 48 |
+
cleaned = re.sub(r"\b\d+\b", "", cleaned) # Remove numbers as tokens
|
| 49 |
|
| 50 |
# Example keyword list
|
| 51 |
keywords = ["blazer", "shirt", "trouser", "saree", "tie", "suit"]
|