个人和结对项目 - 英语单词词频统计

简介:

个人或结对编程项目 英语单词词频统计程序

 

实现一个命令行程序,支持几种模式下的单词词频统计

Implement a console application to tally the frequency of words under a directory.

 

For all text files (file extension: "txt") under a directory (recursively), calculate the frequency of each word, and output the result into a text file.  

2 options to write the program:

    a) Write the code in C++ or C#, using .Net Framework, the running environment is 32-bit Win7 or Win10. with VS studio 2012-2015 profiling tool

    b) Write the code in Java, using latest JDK, run it on Win10, or Linux platform with appropriate Java profiling tool

 

Run performance analysis tool on your code, find performance bottlenecks and improve.

 

Enable Code Quality Analysis for your code and get rid of all warnings.

Code Quality Analysis:  http://msdn.microsoft.com/en-us/library/dd264897.aspx 

 

Write 10 simple test cases to make sure your program can handle these cases correctly (e.g.  a good test case could be: one of the sub-directories is empty).

 

Submission:

Submit your source code and exe to TA, TA will run it on his testing environment and check for

       - correctness   (incorrect program will get 0 points)

       - performance

       - write a blog (see blog requirement below)

 

Definition:

word: a string starting with one English alphabet letters, then followed by optional alphanumerical characters.  Words are separated by delimiters. If a string contains non-alphanumerical characters, it’s not a word. Word is case insensitive, i.e. “file”, “FILE” and “File” are considered the same word.

“file123” is a word, and “123file” is NOT a word.

  - Alphabetic letters:  A-Z, a-z.

  - Alphanumerical characters: A-Z, a-z, 0-9.

  - Delimiter: space, non-alphanumerical letters.

  - Output text file: filename is <your email name>.txt

  - Each line has this format

      <word>: number

Where <word> is the string, showing in all upper-case format.  E.g. if only “File” and “file” appear in the test file,  the program should show “FILE”.

Where “number” is the number of times this word appears in the file(s)  The output should be sorted with most frequent word first.  If 2 words have the same frequency, list the words by dictionary order.

 

Requirements:

1)      Simple mode.   Output simple word frequency.

Myapp.exe <directory-name>

Will output <your-name>.txt file in current directory, the text file contains word ranking list.

2)      Extended mode. 

在执行 Myapp.exe -e2 <directory-name>时,找出最频繁出现的连续两个词(列出前10名)。例如,在一本英文小说中,“good morning” 出现次数最多。

在执行 Myapp.exe -e3 <directory-name>时,找出最频繁出现的连续三个词(列出前10名)。例如“how are you"。

这里连续的词是指由单个空格分隔的词。

The app will output <your-name>.txt file in current directory, the text file contains word ranking list.

3)      support -v, verb tally mode. 

Myapp.exe -v <directory-name>时,找出最频繁出现的动词,包括这个动词出现的各种变态。

在学习英语的过程中我们学习过很多动词,知道动词有原型,和各种时态/语态下的变形。 例如:

原型: do

变形:does, did, done, doing.

那么,一篇英语文章里, 有多少个动词”do” 和它的各种变形呢? 最频繁的动词前10名是什么呢?这就是我们这个练习的目的。

任务分解:

1)自己构造(或者助教提供)一个动词及其变形的文本文件。 每一行开头是原型,后面跟着各种变形,例如:

     do does did done doing

     get gets got gotten getting

     ...

2) 处理

  Myapp.exe -v <directory-name>

    对于每一个符合条件的文件处理, 然后统计出所有文件中最频繁动词的前10名。

Blog Requirement:

You can publish this to BOTH your own blog, and your team blog (to help your team blog get some traffic)

1)      Before you implement this project, Record your estimate about the time you WILL spend in each component of your program.

2)      After you had implemented this project, record the ACTUAL time you spent in each component of your program.

3)      Describe how much time you spent on improving the performance of your program, and show a performance analysis graph (generated by VS2012 perf analysis tool), if possible, please show the most costly function in your program.

4)      Share your 10 test cases, and how did you make sure your program can produce the correct result. (programs with incorrect result will get 0 points,  regardless of speed)

5)      Describe what you had learned in this exercise.





本文转自SoftwareTeacher博客园博客,原文链接:http://www.cnblogs.com/xinz/p/6100228.html,如需转载请自行联系原作者


目录
相关文章
|
SQL 运维 安全
闲鱼交易实时资损防控体系
聊一聊资损防控体系和闲鱼实践
6397 0
闲鱼交易实时资损防控体系
|
6月前
|
人工智能 监控 安全
使用 Ollama + FastAPI 打造轻量级 AI 应用部署方案
本文介绍了一套基于 Ollama 和 FastAPI 的轻量级 AI 模型部署方案,解决云端部署成本高、本地部署复杂的问题。通过 200 行核心代码实现模型加载到 API 服务的全流程,适用于中小型应用。方案结合 Ollama 的本地化运行能力和 FastAPI 的高性能特性,支持模型量化、并发控制和资源监控,提供 Docker 容器化及 K8s 扩展配置,优化性能与安全性。开发者可在 2 小时内完成环境搭建与部署,满足日均百万级请求需求,为 AI 应用快速落地提供有效支持。
569 0
|
9月前
|
机器学习/深度学习 机器人 PyTorch
企业内训|基于华为昇腾910B算力卡的大模型部署和调优-上海某央企智算中心
近日上海,TsingtaoAI为某央企智算中心交付华为昇腾910B算力卡的大模型部署和调优课程。课程深入讲解如何在昇腾NPU上高效地训练、调优和部署PyTorch与Transformer模型,并结合实际应用场景,探索如何优化和迁移模型至昇腾NPU平台。课程涵盖从模型预训练、微调、推理与评估,到性能对比、算子适配、模型调优等一系列关键技术,帮助学员深入理解昇腾NPU的优势及其与主流深度学习框架(如PyTorch、Deepspeed、MindSpore)的结合应用。
958 4
|
机器学习/深度学习 算法 算法框架/工具
改进的yolo目标检测(yolo创新与改进)
改进的yolo目标检测(yolo创新与改进)
|
传感器 缓存 芯片
IMU调试方案
本文是关于IMU(惯性测量单元)QMI8658C型号的调试方案,包括I2C和SPI通信协议的详细介绍、接线方法、工作原理以及优缺点分析,并提供了相关的数据手册和开发资源链接。
260 4
IMU调试方案
|
存储 机器学习/深度学习 API
开源向量数据库比较:Chroma, Milvus, Faiss,Weaviate
该文探讨了向量数据库在语义搜索和RAG中的核心作用,并介绍了四个开源向量数据库:Chroma、Milvus、Faiss和Weaviate。这些数据库用于存储高维向量,支持基于相似性的快速搜索,改变了传统的精确匹配方法。文章详细比较了它们的特性,如Chroma的易用性,Milvus的存储效率,Faiss的GPU加速,和Weaviate的图数据模型。选择合适的数据库取决于具体需求,如数据类型、性能和使用场景。
3084 0
|
JSON JavaScript Java
性能工具之Jmeter压测Thrift RPC服务
【5月更文挑战第21天】性能工具之Jmeter压测Thrift RPC服务
290 1
|
存储 数据可视化 NoSQL
Proteus软件初学笔记一
Proteus软件初学笔记一
302 3
Proteus软件初学笔记一
|
存储 缓存 开发框架
Flutter如何内存优化简单介绍
Flutter是一种流行的跨平台移动应用程序开发框架,它提供了一种高效的方式来构建美观、快速、可靠的应用程序。然而,随着应用程序规模的增加,内存管理成为了一个重要的问题。本文将探讨如何优化Flutter应用程序的内存管理,以提高应用程序的性能和稳定性。
Flutter如何内存优化简单介绍