Update app.py
Browse files
app.py
CHANGED
|
@@ -192,6 +192,20 @@ def apply_highlight(text, ranges):
|
|
| 192 |
result.append(text[prev:])
|
| 193 |
return ''.join(result)
|
| 194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
test_cases = [
|
| 196 |
("TEST-08", "吾輩は、猫である。「名前」は(まだ)ない!", "吾輩は猫である名前はまだない",
|
| 197 |
{'ignore_yakumono': True}),
|
|
|
|
| 192 |
result.append(text[prev:])
|
| 193 |
return ''.join(result)
|
| 194 |
|
| 195 |
+
# test_cases ループの先頭に追加
|
| 196 |
+
for name, src, dst, settings in test_cases:
|
| 197 |
+
src_flags = build_active_flags(src, settings)
|
| 198 |
+
dst_flags = build_active_flags(dst, settings)
|
| 199 |
+
src_tokens = tokenize_with_flags(src, src_flags)
|
| 200 |
+
dst_tokens = tokenize_with_flags(dst, dst_flags)
|
| 201 |
+
if name in ("TEST-30", "TEST-35"):
|
| 202 |
+
print(f"\n=== {name} tokens ===")
|
| 203 |
+
print(f" src_tokens: {src_tokens}")
|
| 204 |
+
print(f" dst_tokens: {dst_tokens}")
|
| 205 |
+
matcher = difflib.SequenceMatcher(None, [t[0] for t in src_tokens], [t[0] for t in dst_tokens], autojunk=False)
|
| 206 |
+
for tag, i1, i2, j1, j2 in matcher.get_opcodes():
|
| 207 |
+
print(f" {tag:10} src={repr(''.join(t[0] for t in src_tokens[i1:i2]))} dst={repr(''.join(t[0] for t in dst_tokens[j1:j2]))}")
|
| 208 |
+
|
| 209 |
test_cases = [
|
| 210 |
("TEST-08", "吾輩は、猫である。「名前」は(まだ)ない!", "吾輩は猫である名前はまだない",
|
| 211 |
{'ignore_yakumono': True}),
|