Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,8 +61,9 @@ def find_exact_match(df1, df2, column_name):
|
|
| 61 |
matches = pd.merge(df1, df2, on=column_name, how='inner')
|
| 62 |
return matches
|
| 63 |
|
|
|
|
| 64 |
def find_similar_texts(df1, df2, column_name, threshold=0.4):
|
| 65 |
-
# Find rows with similar texts in the specified column,
|
| 66 |
similar_texts = []
|
| 67 |
exact_matches = []
|
| 68 |
|
|
@@ -92,13 +93,14 @@ def find_similar_texts(df1, df2, column_name, threshold=0.4):
|
|
| 92 |
if similarity_score >= threshold:
|
| 93 |
if similarity == 1: # Exact match
|
| 94 |
exact_matches.append((i, j, row1[column_name], row2[column_name]))
|
| 95 |
-
|
| 96 |
similar_texts.append((i, j, row1[column_name], row2[column_name]))
|
| 97 |
|
| 98 |
return similar_texts, exact_matches
|
| 99 |
|
| 100 |
|
| 101 |
|
|
|
|
| 102 |
def main():
|
| 103 |
st.title("Item Comparison App")
|
| 104 |
|
|
|
|
| 61 |
matches = pd.merge(df1, df2, on=column_name, how='inner')
|
| 62 |
return matches
|
| 63 |
|
| 64 |
+
|
| 65 |
def find_similar_texts(df1, df2, column_name, threshold=0.4):
|
| 66 |
+
# Find rows with similar texts in the specified column, excluding exact matches
|
| 67 |
similar_texts = []
|
| 68 |
exact_matches = []
|
| 69 |
|
|
|
|
| 93 |
if similarity_score >= threshold:
|
| 94 |
if similarity == 1: # Exact match
|
| 95 |
exact_matches.append((i, j, row1[column_name], row2[column_name]))
|
| 96 |
+
else: # Similar but not the same
|
| 97 |
similar_texts.append((i, j, row1[column_name], row2[column_name]))
|
| 98 |
|
| 99 |
return similar_texts, exact_matches
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
+
|
| 104 |
def main():
|
| 105 |
st.title("Item Comparison App")
|
| 106 |
|