Python英文分词_词频统计_按词频排序

文本cet6read.txt

QuestionS 61 to 65 are based on the following passage.
Many bankers may be worried about whether some fancy product dreamed up might yetlead to a visit from the police. Daniel Dantas, a financier, who has profited by operating at themiddle place where business and government meet in Brazil, has been opening the door to findthe police outside for much of the
  past decade. On December 2nd he was convicted of a less sophisticated crime: trying tobribe police officers. Mr. Dantas, who has acquired great notoriety in Brazil, was fined $ 5million and sentenced to ten years in prison. He has appealed against his conviction.
  The charge stems from a police investigation into money-laundering known asOperation Satiagraha. It grew out of a previous investigation into Mr. Dantas’ use of Kroll, asecurity consultancy, to watch over his business partners. During this investigation the policeseized a computer from Opportunity, Mr. Dantas’s investment bank, which contained datafrom the mid-1990s to 2004 and apparently showed suspicious movements of money.
  The judge found that Mr. Dantas tried to pay bribes, via two go-betweens, to keep hisname out of the Satiagraha investigation. A man fitted with a bugging device was offered $1million in cash, with another $ 4 million to follow, the police say. They claim that Mr. Dantas’strick involved money travelling to the Cayman Islands, then via the British Virgin Islands to anaccount in Ireland, on to Delaware, and then re-entering Brazil as foreign investment.
  For Mr. Dantas his crime is a steep fall from grace. A man who sleeps little and socializesless, he is a vegetarian and self-made billionaire, a gifted financier who has serially fallen outwith his business partners. He once controlled a large telecoms firm, acting for investors whoincluded Citigroup. He says he is the victim of a conspiracy mounted by the government.
  It is Mr. Dantas’ supposed influence in government circles that has added to his notoriety.During the1990s, when many state-owned businesses were privatized, Mr. Dantas positionedhimself as the man with the needed expertise and contacts. He enjoyed easy access to thegovernment of President Femando Henrique Cardoso, including meetings with the presidenthimself. That influence carried through into the government of President Luiz Inacio Lula daSilva. Mr. Dantas is alleged to have been one of the funders of a cash-for-votes scheme inBrazil’s  Congress mounted by leaders of Lula’s Workers’ Party in 2003-2004. Many of thosewho have had dealings with Mr. Dantas insist that these have been legitimate and conducted ingood faith. They include Luiz Eduardo Greenhalgh, a lawyer and PT politician, whom he hired asa consultant.
  61. What kind of crime was Daniel Dantas convicted of according to the passage?
  A.A crime quite experienced and tactful.
  B.A crime by operating at the middle place.
  C.A crime attempting to temper police to work for him.
  D.A crime in money-laundering.
  62. How did the police convict the charge against Mr. Dantas according to the passage?
  A.They seized a computer by chance and got some evidence.
  B.They directly conducted a probe into him.
  C.They found he tempered police officers to delete his name.
  D.They questioned him and made sure the process of money-laundering.
  63. Mr. Dantas’ relationship with his business partners is that __
  A.he usually gets along well with them
  B.he does not have a good relationship with them
  C.he totally trusts all of his business partners
  D.he believes that they make him a victim
  64. What can we learn about Mr. Dantas according to the passage?
  A.He is a gifted financier and less socialized person.
  B.He always enjoys notorious fame in economic and political field.
  C.He is a vegetarian who likes making food by himself.
  D.His tragedy was mounted by the government conspiracy.
  65. What kind of relationship is reflected between Mr. Dantas and government in thepassage?
  A.His influence on government may reduce his notoriety and crime.
  B.In business privatization, he participated with demanding expertise.
  C.He never meets the President himself.
  D.People knowing him deem that he was sheer evil.

import re

# 读取txt文件
with open("cet6read.txt","r",encoding='UTF-8') as f:
    corpus = f.read().strip("\n")
f.close()

# 标点替换为空格、大写字母转换为小写字母、将corpus中每个词拆分成list内元素
corpus = re.sub('[^A-Za-z0-9 ]+', '', corpus).replace("_", '')
corpus = corpus.strip('').lower()
corpus = corpus.split()

# 创建字典、key为单词,value为出现次数
word_fre_dict = dict()
for item in corpus:
    if item not in word_fre_dict:
        word_fre_dict[item]=0
    word_fre_dict[item]+=1
print(word_fre_dict)

# 按照value进行降序排序
word_fre_dict = sorted(word_fre_dict.items(), key=lambda x: x[1], reverse=True)
print(word_fre_dict)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值