Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -58,16 +58,18 @@ def find_exact_matches(df1, df2, column_name):
|
|
58 |
matches = pd.merge(df1, df2, on=column_name, how='inner')
|
59 |
return matches
|
60 |
|
|
|
61 |
def find_similar_texts(df1, df2, column_name, threshold=0.8):
|
62 |
# Find rows with similar texts in the specified column
|
63 |
similar_texts = []
|
64 |
for index1, row1 in df1.iterrows():
|
65 |
for index2, row2 in df2.iterrows():
|
66 |
similarity = SequenceMatcher(None, str(row1[column_name]), str(row2[column_name])).ratio()
|
67 |
-
if similarity >= threshold:
|
68 |
similar_texts.append((index1, index2, row1[column_name], row2[column_name]))
|
69 |
return similar_texts
|
70 |
|
|
|
71 |
def main():
|
72 |
st.title("Item Comparison App")
|
73 |
|
|
|
58 |
matches = pd.merge(df1, df2, on=column_name, how='inner')
|
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 |
similarity = SequenceMatcher(None, str(row1[column_name]), str(row2[column_name])).ratio()
|
68 |
+
if similarity >= threshold and index1 != index2: # Exclude exact matches
|
69 |
similar_texts.append((index1, index2, row1[column_name], row2[column_name]))
|
70 |
return similar_texts
|
71 |
|
72 |
+
|
73 |
def main():
|
74 |
st.title("Item Comparison App")
|
75 |
|