Commit
·
3782fc1
1
Parent(s):
8e74111
More
Browse files
dist.py
CHANGED
@@ -158,17 +158,11 @@ def print_match_summary(str1, str2, wildcard_offsets_str1=None, wildcard_offsets
|
|
158 |
# Create visual representations of the strings with wildcard markers
|
159 |
str1_visual = type(str1)()
|
160 |
for i, char in enumerate(str1):
|
161 |
-
|
162 |
-
str1_visual += f"[{char}]" # Mark wildcards with brackets
|
163 |
-
else:
|
164 |
-
str1_visual += char
|
165 |
|
166 |
-
str2_visual = type(
|
167 |
for i, char in enumerate(str2):
|
168 |
-
|
169 |
-
str2_visual += f"[{char}]" # Mark wildcards with brackets
|
170 |
-
else:
|
171 |
-
str2_visual += char
|
172 |
|
173 |
print(f"Comparing '{str1_visual}' and '{str2_visual}'")
|
174 |
print(f"Wildcards in str1: {sorted(wildcard_offsets_str1)}")
|
@@ -181,8 +175,8 @@ def print_match_summary(str1, str2, wildcard_offsets_str1=None, wildcard_offsets
|
|
181 |
|
182 |
# Visual representation of the alignment
|
183 |
i, j = 0, 0
|
184 |
-
aligned_str1 =
|
185 |
-
aligned_str2 =
|
186 |
match_indicators = ""
|
187 |
|
188 |
for op in operations:
|
@@ -204,18 +198,12 @@ def print_match_summary(str1, str2, wildcard_offsets_str1=None, wildcard_offsets
|
|
204 |
elif "Insertion:" in op:
|
205 |
aligned_str1 += "-"
|
206 |
|
207 |
-
|
208 |
-
aligned_str2 += f"[{str2[j]}]"
|
209 |
-
else:
|
210 |
-
aligned_str2 += str2[j]
|
211 |
|
212 |
match_indicators += " "
|
213 |
j += 1
|
214 |
elif "Deletion:" in op:
|
215 |
-
|
216 |
-
aligned_str1 += f"[{str1[i]}]"
|
217 |
-
else:
|
218 |
-
aligned_str1 += str1[i]
|
219 |
|
220 |
aligned_str2 += "-"
|
221 |
match_indicators += " "
|
|
|
158 |
# Create visual representations of the strings with wildcard markers
|
159 |
str1_visual = type(str1)()
|
160 |
for i, char in enumerate(str1):
|
161 |
+
str1_visual += bytes([char])
|
|
|
|
|
|
|
162 |
|
163 |
+
str2_visual = type(str1)()
|
164 |
for i, char in enumerate(str2):
|
165 |
+
str2_visual += bytes([char])
|
|
|
|
|
|
|
166 |
|
167 |
print(f"Comparing '{str1_visual}' and '{str2_visual}'")
|
168 |
print(f"Wildcards in str1: {sorted(wildcard_offsets_str1)}")
|
|
|
175 |
|
176 |
# Visual representation of the alignment
|
177 |
i, j = 0, 0
|
178 |
+
aligned_str1 = type(str1)()
|
179 |
+
aligned_str2 = type(str1)()
|
180 |
match_indicators = ""
|
181 |
|
182 |
for op in operations:
|
|
|
198 |
elif "Insertion:" in op:
|
199 |
aligned_str1 += "-"
|
200 |
|
201 |
+
aligned_str2 += str2[j:j+1]
|
|
|
|
|
|
|
202 |
|
203 |
match_indicators += " "
|
204 |
j += 1
|
205 |
elif "Deletion:" in op:
|
206 |
+
aligned_str1 += str1[i:i+1]
|
|
|
|
|
|
|
207 |
|
208 |
aligned_str2 += "-"
|
209 |
match_indicators += " "
|