用Python实现针对英文论文的词频分析

本文介绍如何使用Python对英文论文进行词频分析,通过分析高频词汇来提高阅读理解效率。首先,需要将PDF论文转换为Word,再转为txt格式以避免乱码。然后,通过提供的代码实现词汇频次统计。
摘要由CSDN通过智能技术生成

有时候看英文论文,高频词汇是一些术语,可能不太认识,因此我们可以先分析一下该论文的词频,对于高频词汇可以在看论文之前就记住其意思,这样看论文思路会更顺畅一些,接下来就讲一下如何用python输出一篇英文论文的词汇出现频次。

首先肯定要先把论文从PDF版转为txt格式,一般来说直接转会出现乱码,建议先转为Word格式,之后再复制为txt文本格式。

接下来附上含有详细注释的代码

#论文词频分析
#You should convert the file to text format


#Read the text and save all the words in a list
def readtxt(filename):
    fr = open(filename, 'r')
    wordsL = []#use this list to save the words
    for word in fr:
        word = word.strip()
        word = word.split()
        wordsL = wordsL + word
    fr.close()
    return wordsL

#count the frequency of every word and store in a dictionary
#And sort dictionaries by value from large to small
def count(wordsL):
    wordsD = {}
    for x in wordsL:
        #move these words that we don't need
        if Judge(x):
            continue
        #count
        if not x in wor
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值