python词频统计实验报告_Python3.7 练习题(二) 使用Python进行文本词频统计

本文介绍了一种使用Python进行词频统计的方法,通过示例代码展示了如何处理文本并计算每个单词的出现次数。ILM的历史被用作背景,强调了公司在计算机生成视觉效果领域的创新,特别是其在电影行业中的应用。文章提到了ILM如何利用各种操作系统上的大量机器进行批处理,以创建和处理数千帧的电影画面,并指出Python在整合这些复杂系统中所扮演的角色。
摘要由CSDN通过智能技术生成

# 使用Python进行词频统计

mytext= """Background

Industrial Light & Magic (ILM) was started in 1975 by filmmaker George Lucas, in order to create the special effects for the original Star Wars film. Since then, ILM has grown into a visual effects powerhouse that has contributed not just to the entire Star Wars series, but also to films as diverse as Forrest Gump, Jurassic Park, Who Framed Roger Rabbit, Raiders of the Lost Ark, and Terminator 2. ILM has won numerous Academy Awards for Best Visual Effects, not to mention a string of Clio awards forits work on television advertisements.

While much of ILM's early work was done with miniature models and motion controlled cameras, ILM has long been on the bleeding edge of computer generated visual effects. Its computer graphics division dates back to 1979, and its first CG production was the 1982 Genesis sequence from Star Trek II: The Wrath of Khan.

In the early days, ILM was involved with the creation of custom computer graphics hardware and softwarefor scanning, modeling, rendering, and compositing (the process of joining rendered and scanned images together). Some of these systems made significant advances in areas such asmorphing and simulating muscles and hair.

Naturally,as time went by many of the early innovations at ILM made it into the commercial realm, but the company's position on the cutting edge of visual effects technology continues to rely on an ever-changing combination of custom in-house technologies and commercial products.

Today, ILM runs a batch processing environment capable of modeling, rendering and compositing tens of thousands of motion picture frames per day. Thousands of machines running Linux, IRIX, Compaq Tru64, OS X, Solaris, and Windows join together to provide a production pipeline thatis used by approximately eight hundred users daily, many of whom write or modify code that controls every step of the production process. In this context, hundreds of commercial and in-house software components are combined to create and process each frame of computer-generated or enhanced film.

Making allthis work, and keeping it working, requires a certain degree of technical wizardry, as well as a tool set that isup to the task of integrating diverse and frequently changing systems.

Enter Python

Backin 1996, in the 101Dalmation days, ILM was exclusively an SGI IRIX shop, and the production pipeline was controlled by Unix shell scripting.

At that time, ILM was producing15-30 shots per show, typically only a small part of each feature length film to which they were contributing."""def wordcount(str):

strl_list= str.replace('\n', '').lower().split(" ")

count_dict={}for str instrl_list:if str incount_dict.keys():

count_dict[str]= count_dict[str] + 1

else:

count_dict[str]= 1count_list= sorted(count_dict.items(), key=lambda x: x[1], reverse=True)returncount_list

print(wordcount(mytext))

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值