软件工程 个人作业(1) Word Frequency Program

MSRA Advanced Software Engineering

Project:  Individual Project - Word frequency program

2010/11/1

 

 

 

Implement a console application to tally the frequency of words under a directory (based on 2 modes).

 

For all text files under a directory (recursively) (file extensions: "txt", "cpp", "h", “cs”),   calculate the frequency of each word, and output the result into a text file.  Write the code in C#, using .Net Framework,  the running environment is 32-bit Win7.

 

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

 

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

 

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 a) correctness and b) performance

·         Submit your test cases to TA.

 

Definition:

·         A word: a string with at least 3 letters, separated by delimiters. If a string contains non-alphanumerical letters, it’s not a word.  The word is case insensitive,  i.e. “file”, “FILE” and “File” are considered the same word.

·         Delimiter: space, non-alphanumerical letters (,.<>|/)[]{!@#$%^&*()_+=-}”).

·         Output text file: filename is <your email alias>.txt

o   Each line has this format

<word>: number

                Where “number” is the number of times this word appears in the scan.  The output should be sorted with most frequently word first.  If 2 words have the same frequency, list the words by alphabetical order.

 

Requirements:

1)     Simple mode.   Simple word frequency.

Myapp.exe <directory-name>

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

2)     Extended mode.  If 2 words are different only on the ending numbers.  For example, we consider “win”, “win95” and “win7” are ONE WORD;  “Office” and “Office15” are the same.   “win”  and “win32a” are DIFFERENT words, as the difference are more than just ending numbers. “21century” and “century” are DIFFERENT words too.

 

When running with “-e” command line parameter,

Myapp.exe –e <directory-name>

 

Will output <your-alias>.txt file  in current directory,  the text file contains word ranking list, but the frequency is calculated based on the extended mode definition.  

 

Blender----利用DEM(tif)生成三维模型 利用DEM(tif)生成三维模型 阅读详情

相关推荐

GIS图片地理配准与边界矢量化实操指南:从原理到QGIS应用

图片数字化是GIS数据生产中的基础环节,而将扫描图纸、历史影像等栅格数据转化为可分析空间数据,离不开地理配准与边界矢量化两大核心操作。地理配准通过建立像素坐标与真实地理坐标的映射关系,配合合理分布的控制点与合适的变换模型,消除图像形变并赋予空间位置;矢量化则在此基础上将栅格边界转换为点线面要素。二者结合不仅提升数据精度,还为后续叠加分析、面积量算提供可靠基础,广泛应用于国土规划、历史地图数字化和设计图纸入库等场景。本文以QGIS为工具,系统拆解从坐标系选择、控制点采集到影像输出检查的完整配准流程,并对比自动

weixin_26834281的博客 321

LeetCode 192 Word Frequency

题目 分析 1.利用awk默认一行一条记录,默认以空格划分每条记录,NF为划分的总块数先打印出所有单词。 2.排序+统计+消除重复 3.输出 题解 awk '{i=1;while(i<=NF){print $i;

wangxiaobupt的专栏 2399

新手必看:如何用R/qtl快速完成QTL定位分析(附实战代码)

本文为新手提供了使用R/qtl进行QTL定位分析的完整实战指南。内容涵盖从环境搭建、数据准备与清洗,到核心分析流程(包括遗传图谱计算、单QTL扫描、置换检验确定阈值)以及进阶结果可视化的全步骤。通过清晰的代码示例,帮助读者快速掌握这一数量遗传学关键分析技术,实现从数据到QTL峰值的完整分析闭环。

y7z8a的博客 519

LeetCode192 Word Frequency

待续。。。

李歇特冯-兹拜因巴哈的博客 284

Label Studio保姆级教程:从零搭建医疗影像标注平台(DICOM格式支持)

本文提供基于Label Studio从零搭建医疗影像标注平台的保姆级教程。针对DICOM格式支持,详细阐述了环境部署、DICOM深度集成与预处理、团队协作权限管理以及质量审核闭环等核心环节,旨在构建一个高效、可落地的医疗AI数据标注解决方案,助力模型落地。

nft7creator的博客 310

考试遇到 Assistant API 考点时,该掌握哪些要点?

【摘要】聚焦阿里云大模型 ACP 认证中智能体 Assistant API 考点,我结合自学认证成功经验,分享复习攻略。先解析 assistants、threads 等五个核心组件作用与关系,点明各组件支持及不支持的方法,最后给出计算 Python 代码调用大模型次数的思路,助力考生攻克考点、顺利拿证 。

davidkorhenn的博客 499

Python3.7对文本批量进行词频分析

github上找的源码,自己改的,记在这里。 对图中的文档做分词及词频统计,然后将统计生成的excel表格和分词后的text文本存入result文件夹里。 待分词的文本: 最后生成的文档: 文件批量处理函数: 主要用到os模块为新生成的文件命名,实现批量处理 def word_frequency_analysis(path): files = os.listdir(path) # f......

MilkLeong的博客 5791

光学相干断层扫描(OCT)在 妇科诊断 中的革命性应用

尽管OCT在妇科的应用提供了许多潜在的优势,但它仍然是一个相对新的技术,并不是所有医疗机构都有能力提供这种类型的成像服务。随着技术的发展和医生对OCT的熟悉程度的提高,预计OCT将在妇科和其他医学领域中扮演越来越重要的角色。早期发现和准确的分类是提高治疗成功率的关键。虽然这是一个相对较新的应用领域,但OCT的非侵入性和高分辨率成像能力可能提供有价值的信息,以提高辅助生殖技术的成功率。:光学相干断层扫描(OCT)在阴道和外阴组织的评估中的应用正在逐渐展开,提供了一种新的方法来诊断和监测各种妇科疾病。

LiRongLu_的博客 1728

软件基本功:重构工作的考虑及执行

  手头工作非常之多。按照重要性的排序,吾决定着手重构WP。WP代码量非常之多(未统计,怎么也超过10万行),工作思路吾很清楚,如何进行具体操作,却不是几句话能解决的。于是吾就考虑,如何下手?有以下要考虑的地方: 准备工作   这一阶段的修改,是为了后续重构,所以不能影响功能。即使原来功能是错的,也要继续错。除非要求解决。 桥接   既然是重构,肯定是要重写代码。重写自然就会产生问题。这个时候需要走桥接。即建立一个执行分叉,日常修改测试在新路径进行,正常版本还是走老路子。直到新路径功能已完成,再删除老路

柳鲲鹏 678

EtherCAT从站EEPROM组成信息详解(2):字8-15产品标识区

以实际的从站EEPROM数据为例,参照EtherCAT的SII规范,详细分析了从站EEPROM字8-字15的产品标识区内容组成。

kevin1499的博客 723

STM32F4 Flash数据的保存和读取。

STM32F4 Flash数据的保存和读取。

张一西的博客 9219

软件工程习题

数据流图: ER图:

王小波的博客 3万+

PINN驱动的3D不可压缩流场重建——从稀疏2D2C观测到完整物理场反演——含源码实现

多尺度融合策略在此发挥作用:高分辨率的2D2C数据用于约束平面内的精细结构,而低分辨率的3D3C数据提供第三维度的粗尺度信息。迁移学习架构在此发挥关键作用。这种策略在湍流封闭模型构建中尤为有效,其中RANS提供的平均流场与DNS的雷诺应力数据融合,显著提升了分离流的预测精度。在稀疏数据场景下,注意力权重根据观测数据的分布动态调整,强化数据缺失区域的物理约束,同时避免过拟合于观测点。这种机制与自适应采样的结合,实现了计算效率与重建精度的平衡,在仅保留约百分之十关键节点的情况下,仍能保持高物理一致性。

u012133341的博客 141

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

prime frequency java_软件工程个人项目--Word frequency program

(一)工程设计时间预计1.代码编写:1小时30分钟(1)文件夹的遍历以及筛选;(2)文件夹的读取,以及对读取字符的操作。(3)所得结果排序,以及文件输出。2.程序调试:1小时(1)编写数据。(2)测试以及调试。3.程序优化:1小时;程序优化主要通过以下几个方面:(1)排序的优化;(2)存储数据的优化:通过开更大的空间以换取时间上的优化;(3)查找算法的优化;预计总时间:3小时30分钟(二)工程所用...

weixin_31957989的博客 161

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

软件工程个人项目--Word frequency program

(一)工程设计时间预计 1.代码编写:1小时30分钟 (1)文件夹的遍历以及筛选; (2)文件夹的读取,以及对读取字符的操作。 (3)所得结果排序,以及文件输出。 2.程序调试:1小时 (1)编写数据。 (2)测试以及调试。 3.程序优化:1小时; 程序优化主要通过以下几个方面: (1)排序的优化; (2)存储数据的优化:通过开更大的空...

weixin_30786657的博客 154

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

【软件工程】Word frequency program

一、开始写代码前的规划: 1、尝试用C#来写,之前没有学过C#,对于C++也不熟,所以打算先花1天的时间学习C# 2、整个程序基本分为文件遍历、单词提取、单词匹配、排序、输出几个模块,各个模块大致时间如下: 文件遍历,这个应该就是个递归,应该不会太花时间,加上查阅资料,预计最多半个小时 单词提取,用正则表达式应该挺简单的,5分钟 单词匹配,这个对我来说才是最难的,怎么样保证两个模式下...

weixin_30632883的博客 158

Individual Project - Word frequency program

第一次软件工程的作业就让我弄得够呛啊。原因很多,不过还是自己水平真的有待提高。 一,项目预计用时 由于之前没有写过C++或者C#的程序,对这两种语言没有真实的了解,选了用C++做这次的作业,还临时抓紧去买了本书看看,用的visual studio 2012 还是开始作业前不久才装上的。感觉时间很紧。 计划是用空余时间先大致翻翻书,对C++以及vistual studio有更多的了解与掌握。 ...

weixin_30621711的博客 122

软件工程个人项目-Word frequency program by11061167龚少波

(一)工程设计时间预计 1.代码编写:4小时 熟悉Visual studio 2012的使用; 程序代码部分主要分为三个步骤: (1)主函数的构建,包括各种函数调用及输入输出部分; (2)对目标文件夹的搜索; (3)对文件的中单词的查找筛选及统计。 同时由于对C++语言比较生疏,需要查阅一些工具书和请教别的同学花费较多时间。 2.程序调...

weixin_33836223的博客 136

Project: Individual Project - Word frequency program-11061154周辰光

一、预计用时: (1)明确要求:30min; (2)文件的遍历:2h; (3)Simple mode 词频统计:1h; (4)extendmode词频统计:1h; (5)对单词词频排序输出:0.5h; (6)测试与调试:2h; (7)程序优化:2h; 二、实际用时: (1)遍历文件夹:文件操作本来就没有掌握,自己动手的时候一筹莫展,这部分工作是放在最后...

weixin_30764771的博客 192

第一次软工:individual_project_word_frequency 也是第一次cnblogs

先说说工程预计完成时间和实际用时吧。 大二的时候跟刘超老师学习“面向对象建模”这门课,然后有一个小作业时要写一个词频统计器。当时的要求是给了一个单词表,然后统计单词表中的单词在文中出现的频率,并打印。当时是第一次按照OO的思想和模式进行写的,而且也得到了老师的表扬,被当作一个比较好的例子,在他上课的时候通过PPT展示了出来。语言使用Java写的。 看到这次作...

weixin_30396699的博客 73

Individual Project - Word_frequency

http://www.gdzjdaily.com.cn/cooperate/jkkc/2014-09/24/content_7124705.htm http://www.gdzjdaily.com.cn/cooperate/jkkc/2014-09/24/content_7124761.htm http://www.gdzjdaily.com.cn/cooperate/jkkc/2014-09

223

[Bash]LeetCode192. 统计词频 | Word Frequency

★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs.com/strengthen/)➤GitHub地址:https://github.com/strengthen/LeetCode➤原文地址:https://www.cnblogs.com/streng...

weixin_30815469的博客 136
上一篇: 软件工程 - 学生团队成绩 team blog scores
下一篇: 中科大在50年代的教学理念
SoftwareTeacher
SoftwareTeacher 《编程之美》作者 《编程之美》作者 领域专家: 产品设计技术领域 领域专家: 产品设计技术领域
博客等级 码龄16年 2万+粉丝 334原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址