LING/C SC/PSYC 438/538 Lecture 7 Sandiway Fong.

Slides:



Advertisements
Similar presentations
MS-Word XP Lesson 7.
Advertisements

LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong. Administrivia Homework 3 graded.
 Use the Left and Right arrow keys or the Page Up and Page Down keys to move between the pages. You can also click on the pages to move forward.  To.
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong. Administrivia We'll postpone Homework 4 review until next week …
Dh 1 Million Dh 500,000 Dh 250,000 Dh 125,000 Dh 64,000 Dh 32,000 Dh 16,000 Dh 8,000 Dh 4,000 Dh 2,000 Dh 1,000 Dh 500 Dh 400 Dh 300 Dh 200 Dh 100.
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 2: 8/23.
LING 388: Language and Computers Sandiway Fong Lecture 3: 8/28.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia.
1.10 Strings academy.zariba.com 1. Lecture Content 1.What is a string? 2.Creating and Using strings 3.Manipulating Strings 4.Other String Operations 5.Building.
LING/C SC/PSYC 438/538 Lecture 5 9/8 Sandiway Fong.
Course ILT Folder and file management Unit objectives Explore the contents of a hard disk and view file and folder attributes by using Windows Explorer.
Computer Programming for Biologists Class 2 Oct 31 st, 2014 Karsten Hokamp
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.
Microsoft Office 2013 ®® PowerPoint Tutorial 1 Creating a Presentation.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 4: 8/30.
ICT Foundation 1 Copyright © 2010, IT Gatekeeper Project – Ohiwa Lab. All rights reserved. Character representation.
1 ADVANCED MICROSOFT WORD Lesson 13 – Working with Long Documents Microsoft Office 2003: Advanced.
1 The EDIT Program The Edit program is a full screen text editor that allows you to: Create text files Create text files Edit an existing text files Edit.
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.
Printing a Presentation Objective: Print a PowerPoint Presentation Objective: Print a PowerPoint Presentation Given: Handout, Lecture, previous notes,
Getting Started with Python: Constructs and Pitfalls Sean Deitz Advanced Programming Seminar September 13, 2013.
LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong. Administrivia Homework 2 graded.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia Homework 4 not yet graded …
Perl Variables: Array Web Programming1. Review: Perl Variables Scalar ► e.g. $var1 = “Mary”; $var2= 1; ► holds number, character, string Array ► e.g.
BASIC WORD PROCESSORS WEEK 5. BASIC WORD PROCESSORS Word Processor Word processor is a program which is used to edit text files and format them with font,
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.
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.
1 Your Web Page title body of Web page main heading H2 heading bulleted list paragraph.
Quiz 3 Topics Functions – using and writing. Lists: –operators used with lists. –keywords used with lists. –BIF’s used with lists. –list methods. Loops.
FILE I/O: Low-level 1. The Big Picture 2 Low-Level, cont. Some files are mixed format that are not readable by high- level functions such as xlsread()
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
Computer Programming ||
Miscellaneous Items Loop control, block labels, unless/until, backwards syntax for “if” statements, split, join, substring, length, logical operators,
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong.
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 2 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
LING 388: Computers and Language
Advanced Programming Behnam Hatami Fall 2017.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong.
Perl Variables: Array Web Programming.
LING/C SC/PSYC 438/538 Lecture 6 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 10 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
Perl I/O Learning Objectives:
LING/C SC/PSYC 438/538 Lecture 15 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 18 Sandiway Fong.
LING 408/508: Computational Techniques for Linguists
LING/C SC/PSYC 438/538 Lecture 13 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong.
15-110: Principles of Computing
Lab 3: File Permissions.
CS2911 Week 3, Lab Today Thursday Friday Review Muddiest Point Lab 3
LING 388: Computers and Language
LING/C SC/PSYC 438/538 Lecture 7 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 8 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong.
Presentation transcript:

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

Today's Topics Homework 2 Review A note on Windows and Unicode More basic programming: on string operations and file I/O Reading Homework: Chapter 2 of JM on regular expressions (regex) Perl is great at regexs!

Homework 2 Review Q1: Perl. Q2: Perl. Q3: Python. Q4: Python. What does @a = 4 x 4 do? Q2: Perl. @l1 = ("a", "e", "i", "o" , "u"); @l2 = ("あ", "え", "い", "お", "う"); write a program that builds a hash that maps romaji to hiragana, e.g. $h{i} should be "い" Give examples to show your program works Hint: use a loop and shift (or pop) Q3: Python. Do the same for l1 and l2 in Python using zip. Q4: Python. Do the same, without zip, using list comprehensions

Homework 2 Review Q2: either pop or shift will work here…

Homework 2 Review Q3: Python with zip() Start with Perl (and remove @ and ;) Note: we're using Python3 in this course Python 2.7 doesn't handle non-ASCII characters by default.

Homework 2 Review Q4: Python: use list comprehension (instead of zip()) avoiding zip() is tough in Python: e.g. comprehension {k:v for k,v in zip(l1, l2)} is zip() unavoidable? it creates a temporary list (that's thrown away: garbage collected)

Unicode and PowerShell copy from PowerPoint into NotePad Save As … with encoding set to UTF-8

Unicode and PowerShell Windows 10: Default console is not UTF-8 and uses ancient codepage technology (437 = US)! Set it to UTF-8. Note codepage change. Unfortunately, it now understands UTF-8, but fails to print the character!

Unicode and PowerShell Right-click menu bar Properties > Font Consult https://docs.micro soft.com/en- us/typography/fon t-list/ for the codepages that each font supports

Unicode and PowerShell Default console font is actually called Consolas Even the Lucida Console font family is limited.

Unicode and PowerShell Pick a known Japanese font licensed by Microsoft from Ricoh (Japan). MS Mincho

Unicode and PowerShell Et voilà!

Perl: useful string functions chomp (useful with file I/O) vs. chop To split a string into an array of words: Note: multiple spaces ok with " " variant

Python: .split() string (sentence) splitting is an important part of text processing. Oftentimes we split strings by a regular expression: import re re.split(regex,s)

Perl: useful string functions substr

Perl: useful string functions Transliterate: tr/matchingcharacters/replacementcharacters/modifiers modifiers are optional:

Perl: useful string functions Perl doesn't have a built-in trim-whitespace-from-both-ends-of-a- string function. Can be mimicked using regex (more later) Python:

Python: strings Many methods that work on lists also work on strings

Python: strings List comprehension: sentence = ['A', 'big', 'cat', 'in', 'Tucson'] [x.lower() for x in sentence] Suppose we want to use .endswith() in a list comprehension: Reference: https://docs.python.org/3.7/library/stdtypes.html#text-sequence-type-str