LING/C SC/PSYC 438/538 Lecture 6 Sandiway Fong. Homework 4 Submit one PDF file Your submission should include code and sample runs Due date Monday 21.

Slides:



Advertisements
Similar presentations
How to Turn in Written Homework on CourseWare.  Open/print out the written (or short answer) homework from the weekly page on the course home page. 
Advertisements

LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong. Administrivia Homework 3 graded.
Zhang Hongyi CSCI2100B Data Structures Tutorial 2
Introduction to C++ Programming. A Simple Program: Print a Line of Text // My First C++ Program #include int main( ) { cout
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong. Administrivia Homework 1 graded – you should have gotten an from me.
LING/C SC/PSYC 438/538 Lecture 4 9/1 Sandiway Fong.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 3: 8/28.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/11.
Regular Expressions Regular Expression (or pattern) in Perl – is a template that either matches or doesn’t match a given string. if( $str =~ /hello/){
1 September 6, 2005CS150 Introduction to Computer Science I What Actions Do We Have Part 1 CS150 Introduction to Computer Science I.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia.
Selection Sort Given n numbers to sort: Repeat the following n-1 times:  Mark the first unsorted number  Find the smallest unsorted.
LING/C SC/PSYC 438/538 Lecture 5 9/8 Sandiway Fong.
Group practice in problem design and problem solving
LING/C SC/PSYC 438/538 Lecture 2 Sandiway Fong. Today’s Topics Did you read Chapter 1 of JM? – Short Homework 1 (submit by midnight Saturday) Some slides.
Timothy Lalowski Graduate Assistant Office of Student Affairs STUDENT POSTER DAY APRIL 24 TH, 2014.
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong. Today’s Topics File input/output – open, References Perl modules Homework 2: due next Monday by midnight.
Taking Cornell Notes.
MGS 351 Introduction to Management Information Systems
9/21/ A sample class of Discrete Structures Gongjun Yan Computer Science Department, Old Dominion University, Norfolk, VA (Logical conjunction and.
CSC 107 – Programming For Science. Announcements  Tutors available MTWR in WTC206/WTC208  Special lab (with Macs) & not in the Tutoring Center  Can.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 4: 8/30.
Computer Security coursework 2 Dr Alexei Vernitski.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong. Continuing with Perl Homework 3: first Perl homework – due Sunday by midnight – one PDF file, by .
LING/C SC/PSYC 438/538 Lecture 2 Sandiway Fong. Today’s Topics Did you read Chapter 1 of JM? – Short Homework 2 (submit by midnight Friday) Today is Perl.
LING/C SC/PSYC 438/538 Lecture 7 9/15 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 3 8/30 Sandiway Fong.
ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
Computer Science: A Structured Programming Approach Using C1 2-7 Input/Output Although our programs have implicitly shown how to print messages, we have.
LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong. Administrivia Homework 2 graded.
June 19, Liang-Jun Zhang MTWRF 9:45-11:15 am Sitterson Hall 011 Comp 110 Introduction to Programming.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia Homework 4 not yet graded …
Prof. Alfred J Bird, Ph.D., NBCT Door Code for IT441 Students.
LING 408/508: Programming for Linguists Online Lecture 6 September 14 th.
Word Counter HW Copyright © 2012 Pearson Education, Inc.
1 Project 7: Looping. Project 7 For this project you will produce two Java programs. The requirements for each program will be described separately on.
How to Complete FAFSA (Free Application for Federal Student Aid)
LING/C SC/PSYC 438/538 Online Lecture 7 Sandiway Fong.
CPSC 203 Introduction to Computers Lab 21 By Jie Gao.
Functions Commands Programming Steps Examples Printing Homework Hints.
Helping teachers connect instantly with students and parents.
ICS 151 Digital Logic Design Spring 2004 Administrative Issues.
CS 360 Lab 1 Professor: Krzysztof Nowak TA: Mark Boady.
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
What Actions Do We Have Part 1
Taking Cornell Notes.
LING/C SC/PSYC 438/538 Lecture 10 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 7 Sandiway Fong.
Starter Write a program that asks the user if it is raining today.
LING/C SC/PSYC 438/538 Lecture 7 Sandiway Fong.
LING 388: Computers and Language
LING 388: Computers and Language
HAPPY BIRTHDAY! 21 Fold here
LING/C SC/PSYC 438/538 Lecture 6 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 10 Sandiway Fong.
Inputs and Variables Programming Guides.
Taking Cornell Notes.
LING/C SC/PSYC 438/538 Lecture 13 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong.
Taking Cornell Notes.
HAPPY BIRTHDAY! 21 Fold here
Taking Cornell Notes.
Introduction to Python
Network Administration Homework 1
LING/C SC/PSYC 438/538 Lecture 7 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong.
Presentation transcript:

LING/C SC/PSYC 438/538 Lecture 6 Sandiway Fong

Homework 4 Submit one PDF file Your submission should include code and sample runs Due date Monday 21 st September by midnight

Homework 4 Question 1 – write a program to compute and print a sorted word frequency table for a text file – allow both the option of case folding or not Example file: – Love for the the Bronx Bombers bubbled up in the absence of some local franchise. – On on on the table, we have some eggs. – I have Home Sharing turned on, on both my computer and my Apple tv. – I wish that that question had an answer. – Because he had had too many beers already, he skipped the Friday office happy hour. – Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo. buffalo 5 the 5 on 4 Buffalo 3 had 3 have 2 I 2 some 2 … no case folding:

Homework 4 Hint 1: – start with something like the following file I/O template: /\s+|[,;.?]/ means a regular expression that's either one or more spaces, or one of, (comma), ; (semicolon),. (period), or ? (question mark)

Homework 4 Hint 2: – use a hash to store the word frequencies – remember to sort the hash by value for print out

Homework 4 Question 2 Using the same file as in Question 1. Write a Perl program that detects repeated words (many spell check/grammar programs can do this) Your program should read the input file and print a message stating the line number, the repeated word and its position if one exists. Example output: – Line 1: word 3, “the” is repeated 2 times – Line 2: word 1, “on” is repeated 3 times – etc. Note: case

Homework 4 Question 3: describe how a repeated word program could stop flagging legitimate examples of repeated words in a sentence – Examples: I wish that that question had an answer Because he had had too many beers already, he skipped the Friday office happy hour

Homework 4 Microsoft Word: