LING/C SC/PSYC 438/538 Lecture 4 9/1 Sandiway Fong.

Slides:



Advertisements
Similar presentations
LING 388: Language and Computers Sandiway Fong Lecture 5: 9/5.
Advertisements

LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong. Administrivia We'll postpone Homework 4 review until next week …
Computer Programming for Biologists Class 9 Dec 4 th, 2014 Karsten Hokamp
Objectives Using functions to organize PHP code
PHP Conditions MIS 3501, Fall 2014 Jeremy Shafer Department of MIS Fox School of Business Temple University September 11, 2014.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong. Administrivia Homework 1 graded – you should have gotten an from me.
Programming Perls* Objective: To introduce students to the perl language. –Perl is a language for getting your job done. –Making Easy Things Easy & Hard.
PHP Functions and Control Structures. 2 Defining Functions Functions are groups of statements that you can execute as a single unit Function definitions.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 3: 8/28.
Scripting Languages Chapter 6 I/O Basics. Input from STDIN We’ve been doing so with $line = chomp($line); Same as chomp($line= ); line input op gives.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/11.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 2: 8/23.
CS101- Lecture 11 CS101 Fall 2004 Course Introduction Professor Douglas Moody –Monday – 12:00-1:40 – – –Web Site: websupport1.citytech.cuny.edu.
LING 388: Language and Computers Sandiway Fong Lecture 3: 8/28.
LING/C SC/PSYC 438/538 Lecture 5 9/8 Sandiway Fong.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607 Office Hours – Tuesday and.
LING 408/508: Programming for Linguists Lecture 19 November 4 th.
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.
Introduction to Perl & BioPerl Dr G. P. S. Raghava Bioinformatics Centre Bioinformatics Centre IMTECH, Chandigarh Web:
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 4: 8/30.
An Overview of Programming in Python CSC 161: The Art of Programming Prof. Henry Kautz 9/9/2009 Slides stolen shamelessly from Dr. Mark Goadrich, Centenary.
LING 388: Language and Computers Sandiway Fong Lecture 30 12/8.
LING 388: Language and Computers Sandiway Fong Lecture 7 9/15.
LING/C SC/PSYC 438/538 Lecture 7 9/15 Sandiway Fong.
Meet Perl, Part 2 Flow of Control and I/O. Perl Statements Lots of different ways to write similar statements –Can make your code look more like natural.
Agenda Regular Expressions (Appendix A in Text) –Definition / Purpose –Commands that Use Regular Expressions –Using Regular Expressions –Using the Replacement.
LING/C SC/PSYC 438/538 Lecture 3 8/30 Sandiway Fong.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
PHP Programming with MySQL Slide 4-1 CHAPTER 4 Functions and Control Structures.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Computer Programming for Biologists Class 3 Nov 13 th, 2014 Karsten Hokamp
Computer Science 101 Spring 2000 Section E8TBA Registration Code 1693 Dr. Christopher Vickery.
Artificial Intelligence Lecture No. 26 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia Homework 4 not yet graded …
LING 408/508: Programming for Linguists Lecture 5 September 9 th.
ICS3U_FileIO.ppt File Input/Output (I/O)‏ ICS3U_FileIO.ppt File I/O Declare a file object File myFile = new File("billy.txt"); a file object whose name.
LING/C SC/PSYC 438/538 Lecture 18 Sandiway Fong. Adminstrivia Homework 7 out today – due Saturday by midnight.
Midterm Exam Topics (Prof. Chang's section) CMSC 201.
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.
CSC 4630 Meeting 17 March 21, Exam/Quiz Schedule Due to ice, travel, research and other commitments that we all have: –Quiz 2, scheduled for Monday.
LING/C SC/PSYC 438/538 Lecture 10 Sandiway Fong. Today's Topics A note on the UIUC POS Tagger Fun with POS Tagging Perl regex wrap-up.
LING/C SC/PSYC 438/538 Online Lecture 7 Sandiway Fong.
Dept. of Animal Breeding and Genetics Programming basics & introduction to PERL Mats Pettersson.
CSC 4630 Perl 3 adapted from R. E. Beck. Problem But we worked on it first: Input: Read from a text file named in a command line argument Output: List.
PROBLEM SOLVING AND PROGRAMMING ISMAIL ABUMUHFOUZ | CS 170.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Introduction to Programming the WWW I CMSC Winter 2004 Lecture 8.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
Chapter 7 Text Input/Output Objectives
Python’s input and output
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.
LING 388: Computers and Language
CS190/295 Programming in Python for Life Sciences: Lecture 1
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong.
Topics Introduction to File Input and Output
LING/C SC/PSYC 438/538 Lecture 6 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 10 Sandiway Fong.
LING 388: Computers and Language
Introduction to Computer Science
Topics Introduction to File Input and Output
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong.
Presentation transcript:

LING/C SC/PSYC 438/538 Lecture 4 9/1 Sandiway Fong

Administrivia Reminder – homework from lecture 3 – due: next Tuesday midnight – (I want to go through it in class next Wednesday) Guest lectures – Dr. Nirav Merchant, Bioinformatics, Monday September 20 th – Dr. Ray Tillman,US Air Force Research Labs, Mesa AZ, TBA

Adminstrivia Related course – LING 408 / 508, Fall 2010 – Computational Techniques for Linguists – Instructor: Erwin Chan – Monday, Wednesday, Friday 12:00-12:50 PM, Social Sciences 224 – This course will introduce students to computer programming for analyzing linguistic data. The programming languages to be used are Python and R. – syllabus.pdf

Sentiment Analysis (thanks: Don Merson) Viralheat uses natural-language processing and machine learning to sift through Twitter, Facebook fan pages, viral video sites, and Google Buzz posts to determine the Web’s collective sentiment toward various topics. go beyond how often something is mentioned

Perl Week Last topics today – Other useful things for arrays: shift, unshift, push, pop – simple file input/output (I/O) – $ARGV[0] Reading – – Section on Regular expressions – in conjunction with chapter 2 of JM

Perl Week Arrays: – insertion and deletion from the ends 012n-1n-2 shift/unshift pop/push Generalized form

Perl Week Files: must be opened for reading or writing (overwrite or append modes) Opening a file creates a file handle (Perl variable) – not to be confused with filename Specify the file handle from input or writing to output Files: must be opened for reading or writing (overwrite or append modes) Opening a file creates a file handle (Perl variable) – not to be confused with filename Specify the file handle from input or writing to output

Perl Week Example Perl code (template) for reading in a file line-by-line (file 4.prl ): open($txtfile, $ARGV[0]) or die "$ARGV[0] not found!\n"; while ($line = ) { print "$line"; } the command $line = reads in from the file referenced by the file handle $txtfile a single line at a time (including the newline at the end of the line) and places that line in the variable $line. (At the end of the file, $line is just an empty string – which fails the while condition and thus exits the loop.) the filename is picked up from the command line and placed in the Hence: – perl 4.prl words2.txt – returns words2.txt not found! via the die statement because the open statement would evaluate to false (assuming words2.txt doesn’t exist). The while loop doesn’t get executed at all. – But –perl 4.prl words.txt – would execute the while loop and print each line of the file when words.txt exists.