Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -59,17 +59,19 @@ def find_exact_matches(df1, df2, column_name):
|
|
59 |
return matches
|
60 |
|
61 |
|
62 |
-
def find_similar_texts(df1, df2, column_name, threshold=0.8):
|
63 |
-
# Find rows with similar texts in the specified column
|
64 |
similar_texts = []
|
65 |
for index1, row1 in df1.iterrows():
|
66 |
for index2, row2 in df2.iterrows():
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
70 |
return similar_texts
|
71 |
|
72 |
|
|
|
73 |
def main():
|
74 |
st.title("Item Comparison App")
|
75 |
|
|
|
59 |
return matches
|
60 |
|
61 |
|
62 |
+
def find_similar_texts(df1, df2, column_name, exact_matches, threshold=0.8):
|
63 |
+
# Find rows with similar texts in the specified column, excluding exact matches
|
64 |
similar_texts = []
|
65 |
for index1, row1 in df1.iterrows():
|
66 |
for index2, row2 in df2.iterrows():
|
67 |
+
if (index1, index2) not in exact_matches:
|
68 |
+
similarity = SequenceMatcher(None, str(row1[column_name]), str(row2[column_name])).ratio()
|
69 |
+
if similarity >= threshold:
|
70 |
+
similar_texts.append((index1, index2, row1[column_name], row2[column_name]))
|
71 |
return similar_texts
|
72 |
|
73 |
|
74 |
+
|
75 |
def main():
|
76 |
st.title("Item Comparison App")
|
77 |
|