This commit is contained in:
2025-12-19 12:15:03 +08:00
parent d1df40c1cd
commit 579a575087
2 changed files with 3 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
[metadata] [metadata]
# replace with your username: # replace with your username:
name = guan name = guan
version = 0.1.193 version = 0.1.194
author = guanjihuan author = guanjihuan
author_email = guanjihuan@163.com author_email = guanjihuan@163.com
description = An open source python package description = An open source python package

View File

@@ -88,7 +88,7 @@ def word_diff(a, b, print_show=1):
jieba.setLogLevel(logging.ERROR) jieba.setLogLevel(logging.ERROR)
a_words = jieba.lcut(a) a_words = jieba.lcut(a)
b_words = jieba.lcut(b) b_words = jieba.lcut(b)
sm = difflib.SequenceMatcher(None, a_words, b_words) sm = difflib.SequenceMatcher(None, a_words, b_words, autojunk=False)
result = [] result = []
for tag, i1, i2, j1, j2 in sm.get_opcodes(): for tag, i1, i2, j1, j2 in sm.get_opcodes():
if tag == "equal": if tag == "equal":
@@ -115,7 +115,7 @@ def word_diff_to_html(a, b, filename='diff_result', write_file=1):
jieba.setLogLevel(logging.ERROR) jieba.setLogLevel(logging.ERROR)
a_words = jieba.lcut(a) a_words = jieba.lcut(a)
b_words = jieba.lcut(b) b_words = jieba.lcut(b)
sm = difflib.SequenceMatcher(None, a_words, b_words) sm = difflib.SequenceMatcher(None, a_words, b_words, autojunk=False)
html_parts = [] html_parts = []
for tag, i1, i2, j1, j2 in sm.get_opcodes(): for tag, i1, i2, j1, j2 in sm.get_opcodes():
if tag == "equal": if tag == "equal":