Giter Club home page Giter Club logo

ttds-hw0's Introduction

LAB 0

How to read a text file from hard-disk.

This lab is optional for those who are not fully confident about their programming skills.

There is nothing specific to be done in this lab more than reading a text file from HD word by word, which is the most basic skill you need to have to be able to take the course.

PROGRAMMING LANGUAGES

You need to have Perl or Python on your machine (you still can use something else) if you prefer. If you are using Dice, then you should have them there. Check with demonstrators how to run them.

DOWNLOAD A SAMPLE TEXT FILE

Download the following file, which has the text of the Bible: link

SKILLS TO DO WITH THE FILE

You need to be confident with the following skills with any programming language when dealing with a text file:

  • Reading and Writing into text files
  • Reading text by word, and calling functions to process word if required (e.g. lower case word letters)
  • Regular expressions would be very useful to know

USEFUL TIPS

Useful Shell Commands Print frequency of unique terms in a given collection:

  • cat text.file | tr " " "\n" | tr "A-Z" "a-z" | sort | uniq -c | sort -n > terms.freq
  • cat text.file | perl -p -e "s/[^\w]+/\n/g" | tr "A-Z" "a-z" | sort | uniq -c | sort -n > terms.freq

ttds-hw0's People

Watchers

Azfar I. avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.