1 Star 0 Fork 14

Joe/ant-learn-python-100P

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
p039_article_check_sim.py 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
cztps2 提交于 2021-06-03 22:11 . xx
"""
Python实现小型的论文查重系统
"""
python_article = "./datas/articles/Python-计算机编程语言.txt"
flask_article = "./datas/articles/Flask-PythonWeb应用框架.txt"
java_article = "./datas/articles/Java-计算编程语言.txt"
shortvideo_article = "./datas/articles/短视频-简介.txt"
import jieba.analyse
def get_keyword_from_article(fname):
with open(fname) as fin:
content = fin.read()
return jieba.analyse.extract_tags(content, 50)
def compute_sim(wordsa, wordsb):
jiaoji = set(wordsa).intersection(set(wordsb))
bingji = set(wordsa).union(set(wordsb))
return round(len(jiaoji) * 100 / len(bingji), 2)
python_words = get_keyword_from_article(python_article)
flask_words = get_keyword_from_article(flask_article)
java_words = get_keyword_from_article(java_article)
shortvideo_words = get_keyword_from_article(shortvideo_article)
print("python vs python", compute_sim(python_words, python_words))
print("python vs flask", compute_sim(python_words, flask_words))
print("python vs java", compute_sim(python_words, java_words))
print("python vs shortvideo", compute_sim(python_words, shortvideo_words))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/stayhungry2022/ant-learn-python-100P.git
[email protected]:stayhungry2022/ant-learn-python-100P.git
stayhungry2022
ant-learn-python-100P
ant-learn-python-100P
master

搜索帮助