Spaces:
Sleeping
Sleeping
fschwartzer
commited on
Commit
•
1efcf05
1
Parent(s):
00d40be
Update app.py
Browse files
app.py
CHANGED
@@ -22,14 +22,14 @@ def fetch_data_to_dataframe(query, limit=50, source="mercadolibre"):
|
|
22 |
return df
|
23 |
return pd.DataFrame()
|
24 |
|
25 |
-
def refinar_resultados(df):
|
26 |
df['Title'] = df['Title'].astype(str)
|
27 |
|
28 |
# Define a list of keywords to exclude, indicating multiples
|
29 |
exclude_keywords = ["kit", "conjunto", "pacote", "caixa", "unidades"]
|
30 |
|
31 |
# Add conditional exclusion for words not included in the query
|
32 |
-
exclude_patterns = [keyword for keyword in exclude_keywords if keyword not in
|
33 |
|
34 |
# Combine all exclude patterns into a single regex pattern
|
35 |
exclude_pattern = r'\b(' + '|'.join(exclude_patterns) + r')\b|\b(\d+)\s*(unidade|pacotes|caixas)\b'
|
|
|
22 |
return df
|
23 |
return pd.DataFrame()
|
24 |
|
25 |
+
def refinar_resultados(df, include_word=[]):
|
26 |
df['Title'] = df['Title'].astype(str)
|
27 |
|
28 |
# Define a list of keywords to exclude, indicating multiples
|
29 |
exclude_keywords = ["kit", "conjunto", "pacote", "caixa", "unidades"]
|
30 |
|
31 |
# Add conditional exclusion for words not included in the query
|
32 |
+
exclude_patterns = [keyword for keyword in exclude_keywords if keyword not in include_word]
|
33 |
|
34 |
# Combine all exclude patterns into a single regex pattern
|
35 |
exclude_pattern = r'\b(' + '|'.join(exclude_patterns) + r')\b|\b(\d+)\s*(unidade|pacotes|caixas)\b'
|